Spaces:
Build error
Build error
Commit ·
49fb8fc
1
Parent(s): c55e997
Try fix...
Browse files
app.py
CHANGED
|
@@ -4,15 +4,15 @@ import gradio as gr
|
|
| 4 |
import spaces
|
| 5 |
from faster_whisper import WhisperModel
|
| 6 |
|
|
|
|
| 7 |
|
| 8 |
@spaces.GPU(duration=120)
|
| 9 |
def transcribe(gradio_input_one_return_audio_filepath: str):
|
| 10 |
"""Makes a call to transcribe the audio"""
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
model = get_model()
|
| 16 |
segments, _ = model.transcribe(gradio_input_one_return_audio_filepath)
|
| 17 |
return "\n".join([seg.text for seg in segments])
|
| 18 |
|
|
|
|
| 4 |
import spaces
|
| 5 |
from faster_whisper import WhisperModel
|
| 6 |
|
| 7 |
+
model = None;
|
| 8 |
|
| 9 |
@spaces.GPU(duration=120)
|
| 10 |
def transcribe(gradio_input_one_return_audio_filepath: str):
|
| 11 |
"""Makes a call to transcribe the audio"""
|
| 12 |
+
global model;
|
| 13 |
+
if model is None:
|
| 14 |
+
model = WhisperModel("large-v3", device="cuda", compute_type="float16")
|
| 15 |
|
|
|
|
| 16 |
segments, _ = model.transcribe(gradio_input_one_return_audio_filepath)
|
| 17 |
return "\n".join([seg.text for seg in segments])
|
| 18 |
|