Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,11 +42,15 @@ def synthesise(text):
|
|
42 |
|
43 |
return speech.waveform
|
44 |
|
|
|
|
|
|
|
45 |
|
46 |
def speech_to_speech_translation(audio):
|
47 |
translated_text = translate(audio)
|
48 |
synthesised_speech = synthesise(translated_text)
|
49 |
synthesised_speech = (synthesised_speech.numpy() * 32767).astype(np.int16)
|
|
|
50 |
return 16000, synthesised_speech
|
51 |
|
52 |
|
|
|
42 |
|
43 |
return speech.waveform
|
44 |
|
45 |
+
def speech_to_speech_translation_fix(audio,voice_preset="v2/zh_speaker_1"):
|
46 |
+
synthesised_rate,synthesised_speech = speech_to_speech_translation(audio,voice_preset)
|
47 |
+
return synthesised_rate,synthesised_speech.T
|
48 |
|
49 |
def speech_to_speech_translation(audio):
|
50 |
translated_text = translate(audio)
|
51 |
synthesised_speech = synthesise(translated_text)
|
52 |
synthesised_speech = (synthesised_speech.numpy() * 32767).astype(np.int16)
|
53 |
+
synthesised_speech = speech_to_speech_translation_fix(synthesised_speech)
|
54 |
return 16000, synthesised_speech
|
55 |
|
56 |
|