vladelesin
commited on
Commit
•
de68bdb
1
Parent(s):
cbeee19
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 |
-
translated_text = translate(
|
37 |
speech = model.generate(**tokenizer(translated_text, return_tensors="pt"))
|
38 |
return speech.to("cpu")
|
39 |
|
40 |
-
def speech_to_speech_translation(
|
41 |
-
synthesised_speech = synthesise(
|
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(audio):
|
36 |
+
translated_text = translate(audio)
|
37 |
speech = model.generate(**tokenizer(translated_text, return_tensors="pt"))
|
38 |
return speech.to("cpu")
|
39 |
|
40 |
+
def speech_to_speech_translation(audio):
|
41 |
+
synthesised_speech = synthesise(audio)
|
42 |
synthesised_speech = (synthesised_speech.numpy() * 32767).astype(np.int16)
|
43 |
return 16000, synthesised_speech[0]
|
44 |
|