Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -91,14 +91,15 @@ def whisper_speech_demo(multilingual_text, speaker_audio):
|
|
91 |
audio_np = generate_segment_audio(text_str, lang, speaker_url, pipe)
|
92 |
print("Audio segment shape:", audio_np.shape) # Debug statement
|
93 |
audio_segments.append(audio_np)
|
|
|
94 |
concatenated_audio = concatenate_audio_segments(audio_segments)
|
95 |
print("Final concatenated audio shape:", concatenated_audio.shape) # Debug statement
|
96 |
-
# audio_stereo = np.stack((concatenated_audio, concatenated_audio), axis=-1)
|
97 |
-
# audio_stereo = audio_stereo.reshape(-1, 2)
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
102 |
|
103 |
with gr.Blocks() as demo:
|
104 |
gr.Markdown(title)
|
|
|
91 |
audio_np = generate_segment_audio(text_str, lang, speaker_url, pipe)
|
92 |
print("Audio segment shape:", audio_np.shape) # Debug statement
|
93 |
audio_segments.append(audio_np)
|
94 |
+
|
95 |
concatenated_audio = concatenate_audio_segments(audio_segments)
|
96 |
print("Final concatenated audio shape:", concatenated_audio.shape) # Debug statement
|
|
|
|
|
97 |
|
98 |
+
# Normalize the concatenated audio
|
99 |
+
concatenated_audio = concatenated_audio / np.max(np.abs(concatenated_audio))
|
100 |
+
|
101 |
+
# Return the concatenated audio as a NumPy array
|
102 |
+
return concatenated_audio
|
103 |
|
104 |
with gr.Blocks() as demo:
|
105 |
gr.Markdown(title)
|