SteveDigital
commited on
Commit
•
b640e62
1
Parent(s):
f3473b2
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from pytube import YouTube
|
|
3 |
from transformers import pipeline
|
4 |
import gradio as gr
|
5 |
import os
|
|
|
6 |
|
7 |
model = whisper.load_model("base")
|
8 |
summarizer = pipeline("summarization")
|
@@ -22,9 +23,8 @@ def get_text(url):
|
|
22 |
return result['text']
|
23 |
|
24 |
def get_summary(article):
|
25 |
-
|
26 |
-
b = summarizer(
|
27 |
-
print(b)
|
28 |
b = b[0]['summary_text']
|
29 |
return b
|
30 |
|
|
|
3 |
from transformers import pipeline
|
4 |
import gradio as gr
|
5 |
import os
|
6 |
+
import re
|
7 |
|
8 |
model = whisper.load_model("base")
|
9 |
summarizer = pipeline("summarization")
|
|
|
23 |
return result['text']
|
24 |
|
25 |
def get_summary(article):
|
26 |
+
first_sentences = ' '.join(re.split(r'(?<=[.:;])\s', article)[:5])
|
27 |
+
b = summarizer(first_sentences, min_length=20, max_length=30, do_sample=False)
|
|
|
28 |
b = b[0]['summary_text']
|
29 |
return b
|
30 |
|