Spaces:
Runtime error
Runtime error
Commit
·
51267b6
1
Parent(s):
b26e4ee
first commit
Browse files- app.py +21 -0
- config.py +2 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import whisper
|
2 |
+
import config
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
|
6 |
+
def get_text(audio_path):
|
7 |
+
print(aud)
|
8 |
+
model = whisper.load_model(name='base', download_root=config.MODEL_DIR)
|
9 |
+
results = model.transcribe(audio_path)
|
10 |
+
return results['text']
|
11 |
+
|
12 |
+
|
13 |
+
label = gr.components.Text()
|
14 |
+
vd = gr.components.Audio(type="filepath")
|
15 |
+
|
16 |
+
|
17 |
+
iface = gr.Interface(fn=get_text, inputs=vd, outputs=label)
|
18 |
+
iface.launch()
|
19 |
+
|
20 |
+
|
21 |
+
|
config.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
MODEL_DIR = os.path.join(os.getcwd(), 'models', 'model.h5')
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
openai-whisper
|
2 |
+
gradio
|
3 |
+
ffmpeg-python
|
4 |
+
nvidia-cudnn
|