|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
pipe = pipeline(model="lfurman/whisper-tiny-en") |
|
|
|
def transcribe(audio): |
|
text = pipe(audio)["text"] |
|
return text |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# Whisper Tiny FreeSound Audio Captioning") |
|
gr.Markdown("Upload an audio file for captioning using a fine-tuned Whisper tiny model.") |
|
with gr.Row(): |
|
audio_input = gr.Audio(sources="upload", type="filepath") |
|
text_output = gr.Textbox(label="Audio Caption") |
|
btn = gr.Button("Transcribe") |
|
btn.click(fn=transcribe, inputs=audio_input, outputs=text_output) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |