Spaces:
Runtime error
Runtime error
Upload 2 files
Browse filesApp file uploded
- app.py +21 -0
- requirements.txt +5 -0
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-tiny.en", chunk_length_s=30)
|
| 6 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 7 |
+
|
| 8 |
+
def transcript_and_summarize(audio_file):
|
| 9 |
+
transcript = asr_pipe(audio_file)["text"]
|
| 10 |
+
summary = summarizer(transcript, max_length=100, min_length=30, do_sample=False)[0]["summary_text"]
|
| 11 |
+
return f"**Transcription:**\n{transcript}\n\n**Summary (Notes):**\n{summary}"
|
| 12 |
+
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=transcript_and_summarize,
|
| 15 |
+
inputs=gr.Audio(sources=["upload"], type="filepath"),
|
| 16 |
+
outputs=gr.Textbox(),
|
| 17 |
+
title="Audio Transcription & Note-Making",
|
| 18 |
+
description="Upload an audio file to transcribe and get summarized notes."
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torchvision
|
| 3 |
+
torchaudio
|
| 4 |
+
transformers
|
| 5 |
+
gradio
|