updating to use new model for summary
Browse files
app.py
CHANGED
|
@@ -20,7 +20,8 @@ model = ASRModel.from_pretrained(model_name=MODEL_NAME)
|
|
| 20 |
model.eval()
|
| 21 |
|
| 22 |
# Load the summarization model once at startup
|
| 23 |
-
summarizer = pipeline("summarization", model="Falconsai/text_summarization", device="cpu")
|
|
|
|
| 24 |
|
| 25 |
def get_audio_segment(audio_path, start_second, end_second):
|
| 26 |
"""
|
|
@@ -248,7 +249,7 @@ def summarize_transcript(transcript):
|
|
| 248 |
try:
|
| 249 |
gr.Info("Generating summary...", duration=2)
|
| 250 |
# The pipeline returns a list of dictionaries
|
| 251 |
-
result = summarizer(transcript, max_length=250, min_length=50,
|
| 252 |
# Extract the summary text from the first result
|
| 253 |
summary = result[0]['summary_text']
|
| 254 |
return summary
|
|
|
|
| 20 |
model.eval()
|
| 21 |
|
| 22 |
# Load the summarization model once at startup
|
| 23 |
+
#summarizer = pipeline("summarization", model="Falconsai/text_summarization", device="cpu")
|
| 24 |
+
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
|
| 25 |
|
| 26 |
def get_audio_segment(audio_path, start_second, end_second):
|
| 27 |
"""
|
|
|
|
| 249 |
try:
|
| 250 |
gr.Info("Generating summary...", duration=2)
|
| 251 |
# The pipeline returns a list of dictionaries
|
| 252 |
+
result = summarizer(transcript, max_length=250, min_length=50, num_beams=4, early_stopping=True)
|
| 253 |
# Extract the summary text from the first result
|
| 254 |
summary = result[0]['summary_text']
|
| 255 |
return summary
|