vladelesin commited on
Commit
1f173de
1 Parent(s): d771f86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -31,15 +31,14 @@ def transform_audio_to_speech_en(audio):
31
  return outputs["text"]
32
 
33
  def translator(text):
34
- translated = translator_model.generate(**translator_tokenizer(text, return_tensors="pt", padding=True))
35
- translated_text = translator_tokenizer.decode(translated[0], skip_special_tokens=True)
36
- return translated_text
37
 
38
  def synthesise(translated_text):
39
  translated_text = translator(translated_text)
40
- inputs = vits_tokenizer(translated_text, return_tensors="pt")
41
  with torch.no_grad():
42
- speech = vits_model(**inputs).waveform
43
  return speech.cpu()
44
 
45
  def speech_to_speech_translation(audio):
 
31
  return outputs["text"]
32
 
33
  def translator(text):
34
+ translated_text = translation_en_to_rus(text)
35
+ return translated_text[0]['translation_text']
 
36
 
37
  def synthesise(translated_text):
38
  translated_text = translator(translated_text)
39
+ inputs = tokenizer(translated_text, return_tensors="pt")
40
  with torch.no_grad():
41
+ speech = model(**inputs).waveform
42
  return speech.cpu()
43
 
44
  def speech_to_speech_translation(audio):