Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def speech_to_speech_translation(audio):
|
|
42 |
synthesised_speech = synthesise(translated_text)
|
43 |
synthesised_speech = (
|
44 |
synthesised_speech.numpy() * 32767).astype(np.int16)
|
45 |
-
return
|
46 |
|
47 |
def predict(transType, language, audio, audio_mic = None):
|
48 |
print("debug1:", audio,"debug2", audio_mic)
|
@@ -50,7 +50,7 @@ def predict(transType, language, audio, audio_mic = None):
|
|
50 |
audio = audio_mic
|
51 |
audio = audio[1]
|
52 |
if transType == "Text":
|
53 |
-
return translate(audio)
|
54 |
if transType == "Audio":
|
55 |
return speech_to_speech_translation(audio)
|
56 |
|
@@ -76,7 +76,7 @@ demo = gr.Interface(
|
|
76 |
gr.Audio(label="Record an audio", sources="microphone", type="numpy"),
|
77 |
],
|
78 |
outputs=[
|
79 |
-
gr.Text(label="Text translation"),gr.Audio(label="Audio translation")
|
80 |
],
|
81 |
title=title,
|
82 |
description=description,
|
|
|
42 |
synthesised_speech = synthesise(translated_text)
|
43 |
synthesised_speech = (
|
44 |
synthesised_speech.numpy() * 32767).astype(np.int16)
|
45 |
+
return "", synthesised_speech
|
46 |
|
47 |
def predict(transType, language, audio, audio_mic = None):
|
48 |
print("debug1:", audio,"debug2", audio_mic)
|
|
|
50 |
audio = audio_mic
|
51 |
audio = audio[1]
|
52 |
if transType == "Text":
|
53 |
+
return translate(audio), None
|
54 |
if transType == "Audio":
|
55 |
return speech_to_speech_translation(audio)
|
56 |
|
|
|
76 |
gr.Audio(label="Record an audio", sources="microphone", type="numpy"),
|
77 |
],
|
78 |
outputs=[
|
79 |
+
gr.Text(label="Text translation"),gr.Audio(label="Audio translation",type = "numpy")
|
80 |
],
|
81 |
title=title,
|
82 |
description=description,
|