BassWow commited on
Commit
081257a
·
1 Parent(s): 70fac32

Add application file

Browse files
Files changed (1) hide show
  1. app.py +18 -0
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
+