Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,12 +5,7 @@ from transformers import pipeline
|
|
5 |
import re
|
6 |
import gradio as gr
|
7 |
|
8 |
-
pipe = pipeline("summarization", model="Falconsai/text_summarization"
|
9 |
-
|
10 |
-
def chunk_length(text, max_length = 1024):
|
11 |
-
words = text.split()
|
12 |
-
for i in range(0, len(words), max_length):
|
13 |
-
yield " ".join(words[i:i + max_length])
|
14 |
|
15 |
def extract_youtube_id(url):
|
16 |
"""
|
@@ -31,12 +26,9 @@ def extract_youtube_id(url):
|
|
31 |
return None
|
32 |
|
33 |
def summary(text_transcript):
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
return " ".join(summarized_chunks)
|
38 |
-
except Exception as e:
|
39 |
-
return f"Error during summarization: {e}"
|
40 |
|
41 |
def get_youtube_transcript(link):
|
42 |
video_id= extract_youtube_id(link)
|
|
|
5 |
import re
|
6 |
import gradio as gr
|
7 |
|
8 |
+
pipe = pipeline("summarization", model="Falconsai/text_summarization")
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def extract_youtube_id(url):
|
11 |
"""
|
|
|
26 |
return None
|
27 |
|
28 |
def summary(text_transcript):
|
29 |
+
output = pipe(text_transcript)
|
30 |
+
return output[0]['summary_text']
|
31 |
+
|
|
|
|
|
|
|
32 |
|
33 |
def get_youtube_transcript(link):
|
34 |
video_id= extract_youtube_id(link)
|