File size: 975 Bytes
b789fdf ff9c2e5 cf75eeb b789fdf cf75eeb ff9c2e5 b789fdf ff9c2e5 cf75eeb ff9c2e5 cf75eeb ff9c2e5 cf75eeb ff9c2e5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import gradio as gr
import whisper
from transformers import pipeline
# Load models
model = whisper.load_model("base")
summarizer = pipeline("summarization", model="t5-small")
# Function to transcribe and summarize
def transcribe_and_summarize(audio_file):
# Transcription
result = model.transcribe(audio_file)
transcription = result["text"]
# Summarization
summary = summarizer(transcription, max_length=50, min_length=10, do_sample=False)[0]["summary_text"]
return transcription, summary
# Gradio Interface
inputs = gr.Audio(type="filepath", label="Upload your audio file")
outputs = [
gr.Textbox(label="Transcription"),
gr.Textbox(label="Summary")
]
app = gr.Interface(
fn=transcribe_and_summarize,
inputs=inputs,
outputs=outputs,
title="Audio Transcription and Summarization",
description="Upload an audio file to get its transcription and a summarized version of the content."
)
# Launch the app
app.launch()
|