Spaces:
Sleeping
Sleeping
Eric Guan
commited on
Commit
·
0fb5565
1
Parent(s):
711a34a
Added whisper model
Browse files
app.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
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()
|