Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,26 +35,4 @@ def transcribe_audio(audio_file):
|
|
| 35 |
def summarize_text(text):
|
| 36 |
inputs = summarization_tokenizer(text, return_tensors="pt", max_length=1024, truncation=True)
|
| 37 |
summary_ids = summarization_model.generate(inputs.input_ids, max_length=150, min_length=40, length_penalty=2.0, num_beams=4, early_stopping=True)
|
| 38 |
-
summary
|
| 39 |
-
return summary
|
| 40 |
-
|
| 41 |
-
# Gradio interface
|
| 42 |
-
def process_audio(audio_file):
|
| 43 |
-
transcription = transcribe_audio(audio_file)
|
| 44 |
-
summary = summarize_text(transcription)
|
| 45 |
-
return transcription, summary
|
| 46 |
-
|
| 47 |
-
# Gradio UI
|
| 48 |
-
iface = gr.Interface(
|
| 49 |
-
fn=process_audio,
|
| 50 |
-
inputs=gr.Audio(type="file"),
|
| 51 |
-
outputs=[
|
| 52 |
-
gr.Textbox(label="Transcription"),
|
| 53 |
-
gr.Textbox(label="Summary")
|
| 54 |
-
],
|
| 55 |
-
title="Audio Transcription and Summarization",
|
| 56 |
-
description="Upload an audio file to transcribe and summarize the conversation."
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
# Launch the app
|
| 60 |
-
iface.launch()
|
|
|
|
| 35 |
def summarize_text(text):
|
| 36 |
inputs = summarization_tokenizer(text, return_tensors="pt", max_length=1024, truncation=True)
|
| 37 |
summary_ids = summarization_model.generate(inputs.input_ids, max_length=150, min_length=40, length_penalty=2.0, num_beams=4, early_stopping=True)
|
| 38 |
+
summary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|