Update app.py
Browse files
app.py
CHANGED
@@ -13,13 +13,19 @@ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
|
13 |
|
14 |
def process_youtube_link(youtube_url):
|
15 |
try:
|
16 |
-
yt = YouTube(youtube_url
|
17 |
title = yt.title
|
18 |
print(f"Downloading: {title}")
|
19 |
|
20 |
-
|
21 |
video_path = f"{title}.mp4"
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Extract Audio
|
25 |
audio_path = f"{title}.wav"
|
@@ -36,6 +42,7 @@ def process_youtube_link(youtube_url):
|
|
36 |
return transcribed_text, summary
|
37 |
|
38 |
except Exception as e:
|
|
|
39 |
return f"Error: {str(e)}", ""
|
40 |
|
41 |
# Gradio Interface
|
|
|
13 |
|
14 |
def process_youtube_link(youtube_url):
|
15 |
try:
|
16 |
+
yt = YouTube(youtube_url)
|
17 |
title = yt.title
|
18 |
print(f"Downloading: {title}")
|
19 |
|
20 |
+
ys = yt.streams.get_highest_resolution()
|
21 |
video_path = f"{title}.mp4"
|
22 |
+
ys.download(filename=video_path)
|
23 |
+
|
24 |
+
# Log download success
|
25 |
+
if os.path.exists(video_path):
|
26 |
+
print(f"Download successful: {video_path}")
|
27 |
+
else:
|
28 |
+
print("Download failed!")
|
29 |
|
30 |
# Extract Audio
|
31 |
audio_path = f"{title}.wav"
|
|
|
42 |
return transcribed_text, summary
|
43 |
|
44 |
except Exception as e:
|
45 |
+
print(f"Error: {str(e)}") # Log errors
|
46 |
return f"Error: {str(e)}", ""
|
47 |
|
48 |
# Gradio Interface
|