File size: 647 Bytes
1037a30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()