From 435b29b2eb86d4be9b73fb86110d063c8598b8d5 Mon Sep 17 00:00:00 2001 From: Inbaselvan-ayyanar <141208152+Inbaselvan-ayyanar@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:52:51 +0530 Subject: [PATCH 1/6] Update gcd.py --- gcd.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcd.py b/gcd.py index 0f10da082d7..625bf33a2bd 100644 --- a/gcd.py +++ b/gcd.py @@ -5,10 +5,10 @@ a = int(input("Enter number 1 (a): ")) b = int(input("Enter number 2 (b): ")) -i = 1 -while i <= a and i <= b: - if a % i == 0 and b % i == 0: - gcd = i - i = i + 1 +def calc_GCD(x,y): + if y==0: + return x + return calc_GCD(y,x%y) +gcd=calc_GCD(a,b) print("\nGCD of {0} and {1} = {2}".format(a, b, gcd)) From 728628bc9a30137bc9114ea8ea4bdc82dc4d157a Mon Sep 17 00:00:00 2001 From: Inbaselvan-ayyanar <141208152+Inbaselvan-ayyanar@users.noreply.github.com> Date: Tue, 29 Apr 2025 20:05:41 +0530 Subject: [PATCH 2/6] Update gcd.py From 29878448c8f9c1dd2c4ff772519c01c73208a49e Mon Sep 17 00:00:00 2001 From: Inbaselvan-ayyanar <141208152+Inbaselvan-ayyanar@users.noreply.github.com> Date: Tue, 29 Apr 2025 20:06:20 +0530 Subject: [PATCH 3/6] Update gcd.py From f7e07d149b491f44603ef3f1e1d225af14be884d Mon Sep 17 00:00:00 2001 From: Inbaselvan-ayyanar <141208152+Inbaselvan-ayyanar@users.noreply.github.com> Date: Mon, 5 May 2025 21:57:27 +0530 Subject: [PATCH 4/6] Update String_Palindrome.py more efficient version --- String_Palindrome.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/String_Palindrome.py b/String_Palindrome.py index 6b8302b6477..ab4103fd863 100644 --- a/String_Palindrome.py +++ b/String_Palindrome.py @@ -1,15 +1,15 @@ # Program to check if a string is palindrome or not -my_str = 'aIbohPhoBiA' +my_str = input().strip() # make it suitable for caseless comparison my_str = my_str.casefold() # reverse the string -rev_str = reversed(my_str) +rev_str = my_str[::-1] # check if the string is equal to its reverse -if list(my_str) == list(rev_str): +if my_str == rev_str: print("The string is a palindrome.") else: print("The string is not a palindrome.") From 59a29206302f9d0d62d5c3f74a7969284606ab60 Mon Sep 17 00:00:00 2001 From: Inbaselvan-ayyanar <141208152+Inbaselvan-ayyanar@users.noreply.github.com> Date: Fri, 27 Jun 2025 14:02:02 +0530 Subject: [PATCH 5/6] Create Audio Summarizer --- Audio Summarizer | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Audio Summarizer diff --git a/Audio Summarizer b/Audio Summarizer new file mode 100644 index 00000000000..9968fba15dc --- /dev/null +++ b/Audio Summarizer @@ -0,0 +1,46 @@ +import whisper +import re +import openai +import os + +def transcript_generator(): + # Load Whisper model + model = whisper.load_model("base") + + # Transcribe audio file + result = model.transcribe("audio.mp4") + + # Send the transcript to the summarizer + provide_summarizer(result) + + +def provide_summarizer(Text): + # Set up Groq OpenAI-compatible API credentials + openai.api_key = os.getenv("OPENAI_API_KEY", "your-api-key-here") # Replace or set in environment + openai.api_base = "https://api.groq.com/openai/v1" + + # Extract text from the Whisper result + text_to_summarize = Text["text"] + + # Send the transcription to Groq for summarization + response = openai.ChatCompletion.create( + model="llama3-8b-8192", + messages=[ + {"role": "system", "content": "You are a helpful assistant who summarizes long text into bullet points."}, + {"role": "user", "content": f"Summarize the following:\n\n{text_to_summarize}"} + ] + ) + + # Split the response into sentences + summary = re.split(r'(?<=[.!?]) +', response["choices"][0]["message"]["content"]) + + # Save summary to file + with open("summary.txt", "w+", encoding="utf-8") as file: + for sentence in summary: + cleaned = sentence.strip() + if cleaned: + file.write("- " + cleaned + "\n") + + +if __name__ == "__main__": + transcript_generator() From e8dd8a4d4211f79fc7a591506362677669e53c2c Mon Sep 17 00:00:00 2001 From: Inbaselvan-ayyanar <141208152+Inbaselvan-ayyanar@users.noreply.github.com> Date: Fri, 27 Jun 2025 14:05:21 +0530 Subject: [PATCH 6/6] Create Audio_Summarizer.py --- Audio_Summarizer.py | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Audio_Summarizer.py diff --git a/Audio_Summarizer.py b/Audio_Summarizer.py new file mode 100644 index 00000000000..9968fba15dc --- /dev/null +++ b/Audio_Summarizer.py @@ -0,0 +1,46 @@ +import whisper +import re +import openai +import os + +def transcript_generator(): + # Load Whisper model + model = whisper.load_model("base") + + # Transcribe audio file + result = model.transcribe("audio.mp4") + + # Send the transcript to the summarizer + provide_summarizer(result) + + +def provide_summarizer(Text): + # Set up Groq OpenAI-compatible API credentials + openai.api_key = os.getenv("OPENAI_API_KEY", "your-api-key-here") # Replace or set in environment + openai.api_base = "https://api.groq.com/openai/v1" + + # Extract text from the Whisper result + text_to_summarize = Text["text"] + + # Send the transcription to Groq for summarization + response = openai.ChatCompletion.create( + model="llama3-8b-8192", + messages=[ + {"role": "system", "content": "You are a helpful assistant who summarizes long text into bullet points."}, + {"role": "user", "content": f"Summarize the following:\n\n{text_to_summarize}"} + ] + ) + + # Split the response into sentences + summary = re.split(r'(?<=[.!?]) +', response["choices"][0]["message"]["content"]) + + # Save summary to file + with open("summary.txt", "w+", encoding="utf-8") as file: + for sentence in summary: + cleaned = sentence.strip() + if cleaned: + file.write("- " + cleaned + "\n") + + +if __name__ == "__main__": + transcript_generator()