Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import torch
|
|
| 5 |
import gradio as gr
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
-
# Auto-select device
|
| 9 |
device = 0 if torch.cuda.is_available() else -1
|
| 10 |
|
| 11 |
# Load summarization model
|
|
@@ -54,8 +54,8 @@ def get_youtube_transcript(video_url):
|
|
| 54 |
return "Video ID could not be extracted."
|
| 55 |
|
| 56 |
try:
|
| 57 |
-
|
| 58 |
-
transcript =
|
| 59 |
formatter = TextFormatter()
|
| 60 |
text_transcript = formatter.format_transcript(transcript)
|
| 61 |
return summary(text_transcript)
|
|
@@ -71,5 +71,5 @@ demo = gr.Interface(
|
|
| 71 |
description="Summarize any YouTube video's transcript into a concise version."
|
| 72 |
)
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
+
# Auto-select device
|
| 9 |
device = 0 if torch.cuda.is_available() else -1
|
| 10 |
|
| 11 |
# Load summarization model
|
|
|
|
| 54 |
return "Video ID could not be extracted."
|
| 55 |
|
| 56 |
try:
|
| 57 |
+
api = YouTubeTranscriptApi()
|
| 58 |
+
transcript = api.fetch(video_id) # FIXED for new API
|
| 59 |
formatter = TextFormatter()
|
| 60 |
text_transcript = formatter.format_transcript(transcript)
|
| 61 |
return summary(text_transcript)
|
|
|
|
| 71 |
description="Summarize any YouTube video's transcript into a concise version."
|
| 72 |
)
|
| 73 |
|
| 74 |
+
# Launch with public link enabled
|
| 75 |
+
demo.launch(share=True)
|