Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|