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