ilokavat commited on
Commit
8ee1a24
·
verified ·
1 Parent(s): 433564e

Update app.py for ASR test with Whisper

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,7 +1,11 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ asr_pipeline = pipeline("automatic-speech-recognition", model="openai/whisper-small")
 
5
 
6
+ def transcribe(audio):
7
+ text = asr_pipeline(audio)["text"]
8
+ return text
9
+
10
+ demo = gr.Interface(fn=transcribe, inputs=gr.Audio(type="filepath"), outputs="text")
11
+ demo.launch()