product2204 commited on
Commit
520a66e
1 Parent(s): 6f37fff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -19,12 +19,12 @@ def summarize(result):
19
  summarized_text.append(out)
20
  st.write(summarized_text)
21
 
22
- def get_transcript(video_id):
23
  #youtube_video = "https://www.youtube.com/watch?v=A4OmtyaBHFE"
24
  #video_id = youtube_video.split("=")[1]
25
  #video_id
26
  #st.write(YouTubeVideo(video_id))
27
- transcript = YouTubeTranscriptApi.get_transcript(video_id)
28
  print(transcript[0:5])
29
 
30
  result = ""
@@ -36,6 +36,8 @@ def get_transcript(video_id):
36
 
37
  def main():
38
  video_id=st.text_input("enter video id ")
39
- if video_id:
40
- get_transcript(video_id)
 
 
41
  main()
 
19
  summarized_text.append(out)
20
  st.write(summarized_text)
21
 
22
+ def get_transcript(video_id,language):
23
  #youtube_video = "https://www.youtube.com/watch?v=A4OmtyaBHFE"
24
  #video_id = youtube_video.split("=")[1]
25
  #video_id
26
  #st.write(YouTubeVideo(video_id))
27
+ transcript = YouTubeTranscriptApi.get_transcript(video_id,languages=[language], preserve_formatting=True)
28
  print(transcript[0:5])
29
 
30
  result = ""
 
36
 
37
  def main():
38
  video_id=st.text_input("enter video id ")
39
+ language=st.text_input("Language", value="en")
40
+
41
+ if video_id and language:
42
+ get_transcript(video_id,language)
43
  main()