Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,6 @@ def parse_multilingual_text(input_text):
|
|
37 |
def generate_segment_audio(text, lang, speaker_url, pipe):
|
38 |
if not isinstance(text, str):
|
39 |
text = text.decode("utf-8") if isinstance(text, bytes) else str(text)
|
40 |
-
|
41 |
stoks = pipe.t2s.generate([text], lang=[lang])
|
42 |
audio_data = pipe.generate(stoks, speaker_url, lang)
|
43 |
resample_audio = resampler(newsr=24000)
|
@@ -63,7 +62,8 @@ def whisper_speech_demo(multilingual_text, speaker_audio):
|
|
63 |
audio_segments = []
|
64 |
|
65 |
for lang, text in segments:
|
66 |
-
|
|
|
67 |
audio_segments.append(audio_np)
|
68 |
|
69 |
concatenated_audio = concatenate_audio_segments(audio_segments)
|
@@ -74,7 +74,6 @@ def whisper_speech_demo(multilingual_text, speaker_audio):
|
|
74 |
sf.write(tmp_file.name, audio_stereo, 24000, format='WAV', subtype='PCM_16')
|
75 |
return tmp_file.name
|
76 |
|
77 |
-
|
78 |
with gr.Blocks() as demo:
|
79 |
gr.Markdown(title)
|
80 |
output_audio = gr.Audio(label="Generated Speech")
|
|
|
37 |
def generate_segment_audio(text, lang, speaker_url, pipe):
|
38 |
if not isinstance(text, str):
|
39 |
text = text.decode("utf-8") if isinstance(text, bytes) else str(text)
|
|
|
40 |
stoks = pipe.t2s.generate([text], lang=[lang])
|
41 |
audio_data = pipe.generate(stoks, speaker_url, lang)
|
42 |
resample_audio = resampler(newsr=24000)
|
|
|
62 |
audio_segments = []
|
63 |
|
64 |
for lang, text in segments:
|
65 |
+
text_str = text if isinstance(text, str) else str(text)
|
66 |
+
audio_np = generate_segment_audio(text_str, lang, speaker_url, pipe)
|
67 |
audio_segments.append(audio_np)
|
68 |
|
69 |
concatenated_audio = concatenate_audio_segments(audio_segments)
|
|
|
74 |
sf.write(tmp_file.name, audio_stereo, 24000, format='WAV', subtype='PCM_16')
|
75 |
return tmp_file.name
|
76 |
|
|
|
77 |
with gr.Blocks() as demo:
|
78 |
gr.Markdown(title)
|
79 |
output_audio = gr.Audio(label="Generated Speech")
|