Spaces:
Sleeping
Sleeping
Init
Browse files- app.py +22 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from faster_whisper import WhisperModel
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
model_size = "small"
|
| 5 |
+
|
| 6 |
+
# Run on GPU with FP16
|
| 7 |
+
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
| 8 |
+
|
| 9 |
+
def transcribe(audio):
|
| 10 |
+
segments, _ = model.transcribe(audio, beam_size=5)
|
| 11 |
+
return "".join([segment.text for segment in segments])
|
| 12 |
+
|
| 13 |
+
gr.Interface(
|
| 14 |
+
title = 'Fast Whisper for Speech Recognition',
|
| 15 |
+
fn=transcribe,
|
| 16 |
+
inputs=[
|
| 17 |
+
gr.inputs.Audio(source="microphone", type="filepath")
|
| 18 |
+
],
|
| 19 |
+
outputs=[
|
| 20 |
+
"textbox"
|
| 21 |
+
]
|
| 22 |
+
).launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
faster-whisper
|