vladelesin
commited on
Commit
•
1f173de
1
Parent(s):
d771f86
Update app.py
Browse files
app.py
CHANGED
@@ -31,15 +31,14 @@ def transform_audio_to_speech_en(audio):
|
|
31 |
return outputs["text"]
|
32 |
|
33 |
def translator(text):
|
34 |
-
|
35 |
-
|
36 |
-
return translated_text
|
37 |
|
38 |
def synthesise(translated_text):
|
39 |
translated_text = translator(translated_text)
|
40 |
-
inputs =
|
41 |
with torch.no_grad():
|
42 |
-
speech =
|
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):
|