jefercania commited on
Commit
976ef55
1 Parent(s): 85cf216

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ os.system("pip install git+https://github.com/openai/whisper.git")
3
+ import gradio as gr
4
+ import whisper
5
+
6
+ #LOAD THE MODEL
7
+ model = whisper.load_model("base")
8
+
9
+ #FUNCTION TO TRANSCRIBE
10
+ def speech_to_text(inp):
11
+ result = model.transcribe(inp)
12
+ return result["text"]
13
+
14
+ #LAUNCH THE UI WITH GRADIO
15
+ demo = gr.Interface(fn=speech_to_text,
16
+ inputs=[gr.Audio(type="filepath")],
17
+ outputs=["textbox"]
18
+ )
19
+
20
+ demo.launch(debug=True)
21
+