|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base") |
|
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") |
|
|
|
def summarize_audio(audio_file): |
|
|
|
transcript = transcriber(audio_file)["text"] |
|
|
|
summary = summarizer(transcript, max_length=50, min_length=25, do_sample=False)[0]["summary_text"] |
|
return summary |
|
|
|
|
|
interface = gr.Interface( |
|
fn=summarize_audio, |
|
inputs=gr.Audio(source="upload", type="filepath"), |
|
outputs="text", |
|
title="ืืืืจ ืืืืื ืืกืืืื", |
|
description="ืืขืื ืงืืืฅ ืืืืื ืฉื ืืจืฆื ืืงืื ืกืืืื ืงืฆืจ ืฉื ืืชืืื." |
|
) |
|
|
|
if __name__ == "__main__": |
|
interface.launch() |
|
|