Skip to content

Create Audio Summarizer #2754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Audio Summarizer
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from langchain_community.vectorstores import Chroma
from langchain_ollama import OllamaEmbeddings
from paddleocr import PaddleOCR
import whisper

def transcript_generator():
model = whisper.load_model("base")

result = model.transcribe("audio.mp4")
provide_summarizer(result)


def provide_summarizer(Text):
import re

import openai
openai.api_key="Enter Api Key"
openai.api_base = "https://api.groq.com/openai/v1"

text_to_summarize = Text["text"]

response = openai.ChatCompletion.create(
model="llama3-8b-8192",
messages=[
{"role": "system", "content": "You are a helpful assistant who summarizes long text into points."},
{"role": "user", "content": f"Summarize the following:\n\n{text_to_summarize}"}
]
)

summary = re.split(r"(?<=[!?]) +",response["choices"][0]["message"]["content"])

with open("summary.txt", "w+") as file:
for sentence in summary:
file.write(sentence.strip() + "\n")
file.close()


if __name__ == "__main__":
transcript_generator()
Loading