ramhemanth580 commited on
Commit
230579d
·
verified ·
1 Parent(s): 26d80e6

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +64 -0
  2. requirements.txt +8 -0
app.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from dotenv import load_dotenv
3
+ load_dotenv()
4
+ import os
5
+
6
+ import google.generativeai as genai
7
+ from youtube_transcript_api import YouTubeTranscriptApi
8
+
9
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
10
+
11
+ prompt = """You are a Amazing Youtube video summarizer, Your objective is to take the provided transcript text
12
+ and summerize the entire video transcript into to consise and meaningful summary in points within 250 points, The summary should cover all the
13
+ important points.
14
+ The transcript text is :
15
+ """
16
+
17
+ ## Getting the transcript data from the videos
18
+ def extract_transcript_details(youtube_video_url):
19
+ try:
20
+ video_id = youtube_video_url.split("=")[1]
21
+ transcript_text = YouTubeTranscriptApi.get_transcript(video_id=video_id)
22
+
23
+ transcript = ""
24
+ for i in transcript_text:
25
+ transcript += " "+i["text"]
26
+ return transcript
27
+
28
+ except Exception as e:
29
+ raise e
30
+
31
+ ## getting the esummary based on Prompt from Google Gemini Pro
32
+ def generate_gemini_content(transcript_text,prompt):
33
+
34
+ model = genai.GenerativeModel("gemini-pro")
35
+ response = model.generate_content(prompt+transcript_text)
36
+ return response.text
37
+
38
+
39
+ ## Streamlit APP
40
+
41
+ st.set_page_config(page_title="ATS Resume Expert")
42
+ st.header("Youtube Video Transcriber")
43
+ st.title("Youtube Transcript to detailed notes converter")
44
+
45
+ youtube_link = st.text_input("Enter Youtube Video Link: ")
46
+
47
+ if youtube_link:
48
+ video_id = youtube_link.split("=")[1]
49
+ #print(video_id)
50
+ st.image(f"http://img.youtube.com/vi/{video_id}/0.jpg", use_column_width=True)
51
+
52
+
53
+ if st.button("Get Youtube Video Original Transcript"):
54
+ original_transcript = extract_transcript_details(youtube_link)
55
+ st.subheader('The Original Transcript is ')
56
+ st.write(original_transcript)
57
+
58
+ if st.button("Get Detailed Summary of the Video"):
59
+ transcript_text = extract_transcript_details(youtube_link)
60
+
61
+ if transcript_text:
62
+ summary = generate_gemini_content(transcript_text,prompt)
63
+ st.markdown("## Detailed Notes:")
64
+ st.write(summary)
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ google-generativeai
3
+ python-dotenv
4
+ langchain
5
+ chromadb
6
+ langchain_google_genai
7
+ youtube_transcript_api
8
+ pathlib