vladelesin commited on
Commit
866bb2a
·
1 Parent(s): 13cc003

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -34,8 +34,11 @@ def translate(audio):
34
  return translated_text[0]['translation_text']
35
 
36
  def synthesise(text):
37
- speech = model.generate(**tokenizer(text, return_tensors="pt"))
38
- return speech.to("cpu")
 
 
 
39
 
40
  def speech_to_speech_translation(audio):
41
  translated_text = translate(audio)
 
34
  return translated_text[0]['translation_text']
35
 
36
  def synthesise(text):
37
+ translated_text = translator(text)
38
+ inputs = tokenizer(translated_text, return_tensors="pt")
39
+ with torch.no_grad():
40
+ speech = model(**inputs).waveform
41
+ return speech.cpu()
42
 
43
  def speech_to_speech_translation(audio):
44
  translated_text = translate(audio)