Spaces:
Runtime error
Runtime error
Commit
·
a2ee294
1
Parent(s):
a220cc3
add
Browse files
app.py
CHANGED
|
@@ -51,8 +51,12 @@ pipe = pipeline(
|
|
| 51 |
"automatic-speech-recognition",
|
| 52 |
model="openai/whisper-tiny.en",
|
| 53 |
chunk_length_s=30,
|
| 54 |
-
device=
|
| 55 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
debug = False
|
| 58 |
|
|
@@ -76,7 +80,7 @@ class BaseTrainer(object):
|
|
| 76 |
file_path = tmp_dir+"/tmp.lab"
|
| 77 |
self.textgrid_path = tmp_dir + "/tmp.TextGrid"
|
| 78 |
if not debug:
|
| 79 |
-
text =
|
| 80 |
with open(file_path, "w", encoding="utf-8") as file:
|
| 81 |
file.write(text)
|
| 82 |
|
|
|
|
| 51 |
"automatic-speech-recognition",
|
| 52 |
model="openai/whisper-tiny.en",
|
| 53 |
chunk_length_s=30,
|
| 54 |
+
device=device,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
@spaces.GPU()
|
| 58 |
+
def run_pipeline(audio):
|
| 59 |
+
return pipe(audio, batch_size=8)["text"]
|
| 60 |
|
| 61 |
debug = False
|
| 62 |
|
|
|
|
| 80 |
file_path = tmp_dir+"/tmp.lab"
|
| 81 |
self.textgrid_path = tmp_dir + "/tmp.TextGrid"
|
| 82 |
if not debug:
|
| 83 |
+
text = run_pipeline(audio)
|
| 84 |
with open(file_path, "w", encoding="utf-8") as file:
|
| 85 |
file.write(text)
|
| 86 |
|