Spaces:
Runtime error
Runtime error
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import whisper
|
3 |
+
|
4 |
+
def speech_to_text(tmp_filename, model_size):
|
5 |
+
model = whisper.load_model(model_size)
|
6 |
+
result = model.transcribe(tmp_filename)
|
7 |
+
|
8 |
+
return result["text"]
|
9 |
+
|
10 |
+
|
11 |
+
gr.Interface(
|
12 |
+
fn=speech_to_text,
|
13 |
+
inputs=[
|
14 |
+
gr.Audio(source="microphone", type="filepath"),
|
15 |
+
gr.Dropdown(choices=["tiny", "base", "small", "medium", "large"]),
|
16 |
+
],
|
17 |
+
outputs="text").launch()
|
18 |
+
|