nasirkhan786 commited on
Commit
78571ab
·
0 Parent(s):
Files changed (6) hide show
  1. .gitignore +1 -0
  2. README.md +10 -0
  3. app.py +57 -0
  4. poetry.lock +0 -0
  5. pyproject.toml +18 -0
  6. requirements.txt +4 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .env
README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Youtube Video Transcribe Summarizer LLM App
3
+ emoji: 💻
4
+ colorFrom: yellow
5
+ colorTo: yellow
6
+ sdk: streamlit
7
+ sdk_version: 1.39.0
8
+ app_file: app.py
9
+ pinned:
10
+ ---
app.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from dotenv import load_dotenv
3
+ import google.generativeai as genai # type: ignore
4
+ from youtube_transcript_api import YouTubeTranscriptApi # type: ignore
5
+ import os
6
+
7
+ load_dotenv()
8
+
9
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
10
+
11
+
12
+ prompt = """You are Youtube video summarizer. You will be tacking the transcript text and summarizing
13
+ the entire video and providing the important summary inpoints within 250 words.
14
+ Please provide the summery of the text given here:
15
+ """
16
+ def generate_gemini_response(transcript_text, prompt):
17
+ model = genai.GenerativeModel("gemini-1.5-flash")
18
+ response = model.generate_content([transcript_text+prompt])
19
+ return response.text
20
+
21
+
22
+ ## getting the transcript data from yb videos
23
+ def extract_transcript_details(youtube_video_url):
24
+ try:
25
+ video_id = youtube_video_url.split("=")[1]
26
+ transcript_text = YouTubeTranscriptApi.get_transcript(video_id)
27
+
28
+ transcript = ""
29
+ for i in transcript_text:
30
+ transcript+= " " + i["text"]
31
+
32
+ return transcript
33
+ except Exception as e:
34
+ raise e
35
+
36
+
37
+ # streamlit app
38
+ st.set_page_config(page_title="YB videos Transcrpter")
39
+ st.title("Youtube Transcript to Detailed Notes Converter")
40
+
41
+ youtube_video_link = st.text_input("Enter Your Youtube video Link:")
42
+
43
+ if youtube_video_link:
44
+ # to show the video themnel
45
+ video_id = youtube_video_link.split("=")[1]
46
+ st.image(f"http://img.youtube.com/vi/{video_id}/0.jpg", use_column_width=True)
47
+
48
+
49
+ if st.button("Get detailed Notes"):
50
+ transcript_text = extract_transcript_details(youtube_video_link)
51
+ if transcript_text:
52
+ summary = generate_gemini_response(transcript_text,prompt)
53
+
54
+ st.subheader("Detailed Notes::")
55
+ st.write(summary)
56
+
57
+
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "youtube video transcribe summarizer llm app"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Nasir Abbas <akhtarabbas.islamicreaction@gmail.com>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.12"
10
+ streamlit = "^1.39.0"
11
+ youtube-transcript-api = "^0.6.2"
12
+ google-generativeai = "^0.8.3"
13
+ python-dotenv = "^1.0.1"
14
+
15
+
16
+ [build-system]
17
+ requires = ["poetry-core"]
18
+ build-backend = "poetry.core.masonry.api"
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ youtube_transcript_api
2
+ streamlit
3
+ google-generativeai
4
+ python-dotenv