Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -19,14 +19,17 @@ all_special_ids = pipe.tokenizer.all_special_ids
|
|
19 |
transcribe_token_id = all_special_ids[-5]
|
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 |
-
|
30 |
except error:
|
31 |
print(error)
|
32 |
|
|
|
19 |
transcribe_token_id = all_special_ids[-5]
|
20 |
translate_token_id = all_special_ids[-6]
|
21 |
|
22 |
+
def transcribe(file: UploadFile):
|
23 |
try:
|
24 |
+
print("For processing...")
|
25 |
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
|
26 |
+
print("Call pipeline...")
|
27 |
text = pipe(file, return_timestamps=True)
|
28 |
+
print("Save file...")
|
29 |
file_path = '/home/user/data/new_file.txt'
|
30 |
with open(file_path, "w") as file:
|
31 |
file.write(text)
|
32 |
+
print(text)
|
33 |
except error:
|
34 |
print(error)
|
35 |
|