Spaces:
Runtime error
Runtime error
daveokpare
commited on
Commit
·
3a70f25
1
Parent(s):
297adbe
Modified app and requirements.txt
Browse files- app.py +11 -5
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,16 +1,22 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
import time
|
|
|
4 |
|
5 |
-
|
|
|
|
|
6 |
|
7 |
|
8 |
def transcribe(audio, state=""):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
13 |
|
|
|
14 |
|
15 |
gr.Interface(
|
16 |
fn=transcribe,
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
import time
|
4 |
+
from faster_whisper import WhisperModel
|
5 |
|
6 |
+
model_size = "large-v2
|
7 |
+
|
8 |
+
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
9 |
|
10 |
|
11 |
def transcribe(audio, state=""):
|
12 |
+
segments, info = model.transcribe(audio, beam_size=5)
|
13 |
+
|
14 |
+
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
15 |
+
|
16 |
+
for segment in segments:
|
17 |
+
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
|
18 |
|
19 |
+
return segment.text
|
20 |
|
21 |
gr.Interface(
|
22 |
fn=transcribe,
|
requirements.txt
CHANGED
@@ -2,3 +2,4 @@ gradio==3.16.2
|
|
2 |
transformers
|
3 |
torch
|
4 |
deepspeech==0.8.2
|
|
|
|
2 |
transformers
|
3 |
torch
|
4 |
deepspeech==0.8.2
|
5 |
+
faster-whisper
|