Spaces:
Sleeping
Sleeping
add spaces library
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import time
|
2 |
import os
|
3 |
|
@@ -20,7 +21,9 @@ if LANGUAGE not in SUPPORTED_LANGUAGES:
|
|
20 |
else:
|
21 |
MODEL_PATH = MODEL_PATHS[LANGUAGE]
|
22 |
|
23 |
-
|
|
|
|
|
24 |
"automatic-speech-recognition",
|
25 |
model=MODEL_PATH,
|
26 |
device=0 if torch.cuda.is_available() else -1,
|
@@ -30,6 +33,8 @@ wave2vec_pipeline = pipeline(
|
|
30 |
token=os.getenv("HF_TOKEN"),
|
31 |
)
|
32 |
|
|
|
|
|
33 |
|
34 |
def transcribe_gradio(audio_path: str | None) -> str:
|
35 |
"""
|
|
|
1 |
+
import spaces
|
2 |
import time
|
3 |
import os
|
4 |
|
|
|
21 |
else:
|
22 |
MODEL_PATH = MODEL_PATHS[LANGUAGE]
|
23 |
|
24 |
+
@spaces.GPU
|
25 |
+
def init_pipeline():
|
26 |
+
return pipeline(
|
27 |
"automatic-speech-recognition",
|
28 |
model=MODEL_PATH,
|
29 |
device=0 if torch.cuda.is_available() else -1,
|
|
|
33 |
token=os.getenv("HF_TOKEN"),
|
34 |
)
|
35 |
|
36 |
+
wave2vec_pipeline = init_pipeline()
|
37 |
+
|
38 |
|
39 |
def transcribe_gradio(audio_path: str | None) -> str:
|
40 |
"""
|