yanielbf commited on
Commit
eb3980b
·
1 Parent(s): 4f51cde

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -6
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
- pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
24
- text = pipe(file, return_timestamps=True)
25
- file_path = '/home/user/data/new_file.txt'
26
- with open(file_path, "w") as file:
27
- file.write(text)
28
- return text
 
 
 
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