Mihaj commited on
Commit
0f9c96a
1 Parent(s): 1d5a081

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -81,7 +81,7 @@ def fast_transcribe(diarise, how_diarise, translate, audio):
81
  input_ids = tokenizer_tr(src_text, return_tensors="pt")
82
  generated_tokens = model_tr.generate(**input_ids.to(device))
83
 
84
- trans_eng = tokenizer_tr.batch_decode(generated_tokens, skip_special_tokens=True)
85
  #trans_eng = translator.translate(trans, src='ru', dest="en").text
86
  print(f"TRANSLATION ENDED RESULT {trans_eng}")
87
  lines.append(f"{i+1}\n{start_time_srt} --> {end_time_srt}\n[{label}] {trans}\n[{label}] {trans_eng}\n")
@@ -114,7 +114,7 @@ def fast_transcribe(diarise, how_diarise, translate, audio):
114
  input_ids = tokenizer_tr(src_text, return_tensors="pt")
115
  generated_tokens = model_tr.generate(**input_ids.to(device))
116
 
117
- trans_eng = tokenizer_tr.batch_decode(generated_tokens, skip_special_tokens=True)
118
  #trans_eng = translator.translate(trans, src='ru', dest="en").text
119
  print(f"TRANSLATION ENDED RESULT {trans_eng}")
120
  lines.append(f"{i+1}\n{start_time_srt} --> {end_time_srt}\n{trans}\n{trans_eng}\n")
 
81
  input_ids = tokenizer_tr(src_text, return_tensors="pt")
82
  generated_tokens = model_tr.generate(**input_ids.to(device))
83
 
84
+ trans_eng = tokenizer_tr.batch_decode(generated_tokens, skip_special_tokens=True)[0]
85
  #trans_eng = translator.translate(trans, src='ru', dest="en").text
86
  print(f"TRANSLATION ENDED RESULT {trans_eng}")
87
  lines.append(f"{i+1}\n{start_time_srt} --> {end_time_srt}\n[{label}] {trans}\n[{label}] {trans_eng}\n")
 
114
  input_ids = tokenizer_tr(src_text, return_tensors="pt")
115
  generated_tokens = model_tr.generate(**input_ids.to(device))
116
 
117
+ trans_eng = tokenizer_tr.batch_decode(generated_tokens, skip_special_tokens=True)[0]
118
  #trans_eng = translator.translate(trans, src='ru', dest="en").text
119
  print(f"TRANSLATION ENDED RESULT {trans_eng}")
120
  lines.append(f"{i+1}\n{start_time_srt} --> {end_time_srt}\n{trans}\n{trans_eng}\n")