Update app.py
Browse files
app.py
CHANGED
@@ -57,17 +57,25 @@ def summarize(full_txt, min_summ_len=30):
|
|
57 |
return summ
|
58 |
|
59 |
def extract_text(youtube_video_url,min_summ_len):
|
60 |
-
try:
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
except Exception as e:
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
demo = gr.Interface(
|
73 |
fn=extract_text,
|
|
|
57 |
return summ
|
58 |
|
59 |
def extract_text(youtube_video_url,min_summ_len):
|
60 |
+
# try:
|
61 |
+
# video_id = youtube_video_url.split("=")[1]
|
62 |
+
# transcript_text = YouTubeTranscriptApi.get_transcript(video_id)
|
63 |
+
# transcript = ""
|
64 |
+
# for i in transcript_text:
|
65 |
+
# transcript += " " + i["text"]
|
66 |
+
# print(transcript)
|
67 |
+
# res = summarize(transcript,min_summ_len)
|
68 |
+
# return res
|
69 |
+
# except Exception as e:
|
70 |
+
# raise e
|
71 |
+
video_id = youtube_video_url.split("=")[1]
|
72 |
+
transcript_text = YouTubeTranscriptApi.get_transcript(video_id)
|
73 |
+
transcript = ""
|
74 |
+
for i in transcript_text:
|
75 |
+
transcript += " " + i["text"]
|
76 |
+
print(transcript)
|
77 |
+
res = summarize(transcript,min_summ_len)
|
78 |
+
return res
|
79 |
|
80 |
demo = gr.Interface(
|
81 |
fn=extract_text,
|