Eric Guan commited on
Commit
0fb5565
·
1 Parent(s): 711a34a

Added whisper model

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,7 +1,12 @@
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
+ model = "openai/whisper-small"
5
+ pipe = pipeline("automatic-speech-recognition", model=model)
6
 
7
+ def transcribe(audio):
8
+ transcription = pipe(audio)["text"]
9
+ return transcription
10
+
11
+ demo = gr.Interface(fn=transcribe, inputs=gr.inputs.Audio(source="microphone", type="filepath"), outputs="text")
12
  demo.launch()