Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipe = pipeline(model="lfurman/whisper-tiny-en")
|
5 |
+
|
6 |
+
def transcribe(audio):
|
7 |
+
text = pipe(audio)["text"]
|
8 |
+
return text
|
9 |
+
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
gr.Markdown("# Whisper Tiny FreeSound Audio Captioning")
|
12 |
+
gr.Markdown("Upload an audio file for captioning using a fine-tuned Whisper tiny model.")
|
13 |
+
with gr.Row():
|
14 |
+
audio_input = gr.Audio(sources="upload", type="filepath")
|
15 |
+
text_output = gr.Textbox(label="Audio Caption")
|
16 |
+
btn = gr.Button("Transcribe")
|
17 |
+
btn.click(fn=transcribe, inputs=audio_input, outputs=text_output)
|
18 |
+
|
19 |
+
if __name__ == "__main__":
|
20 |
+
demo.launch()
|