Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -20,12 +20,15 @@ transcribe_token_id = all_special_ids[-5]
|
|
20 |
translate_token_id = all_special_ids[-6]
|
21 |
|
22 |
def transcribe(file):
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
29 |
|
30 |
app = FastAPI()
|
31 |
|
|
|
20 |
translate_token_id = all_special_ids[-6]
|
21 |
|
22 |
def transcribe(file):
|
23 |
+
try:
|
24 |
+
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
|
25 |
+
text = pipe(file, return_timestamps=True)
|
26 |
+
file_path = '/home/user/data/new_file.txt'
|
27 |
+
with open(file_path, "w") as file:
|
28 |
+
file.write(text)
|
29 |
+
return text
|
30 |
+
except error:
|
31 |
+
print(error)
|
32 |
|
33 |
app = FastAPI()
|
34 |
|