Commit
·
76364f3
1
Parent(s):
1d61d5d
Update app.py
Browse files
app.py
CHANGED
@@ -32,13 +32,13 @@ def translate(audio):
|
|
32 |
translated_text = translation_en_to_rus(en_text["text"])
|
33 |
return translated_text[0]['translation_text']
|
34 |
|
35 |
-
def synthesise(
|
36 |
-
|
37 |
-
speech = model.generate(**tokenizer(translated_text, return_tensors="pt"))
|
38 |
return speech.to("cpu")
|
39 |
|
40 |
def speech_to_speech_translation(audio):
|
41 |
-
|
|
|
42 |
synthesised_speech = (synthesised_speech.numpy() * 32767).astype(np.int16)
|
43 |
return 16000, synthesised_speech[0]
|
44 |
|
|
|
32 |
translated_text = translation_en_to_rus(en_text["text"])
|
33 |
return translated_text[0]['translation_text']
|
34 |
|
35 |
+
def synthesise(text):
|
36 |
+
speech = model.generate(**tokenizer(text, return_tensors="pt"))
|
|
|
37 |
return speech.to("cpu")
|
38 |
|
39 |
def speech_to_speech_translation(audio):
|
40 |
+
translated_text = translate(audio)
|
41 |
+
synthesised_speech = synthesise(translated_text)
|
42 |
synthesised_speech = (synthesised_speech.numpy() * 32767).astype(np.int16)
|
43 |
return 16000, synthesised_speech[0]
|
44 |
|