Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -89,10 +89,13 @@ def whisper_speech_demo(multilingual_text, speaker_audio):
|
|
89 |
audio_np = generate_segment_audio(text_str, lang, speaker_url, pipe)
|
90 |
print("Audio segment shape:", audio_np.shape) # Debug statement
|
91 |
audio_segments.append(audio_np)
|
92 |
-
|
93 |
-
print("Final concatenated audio shape:", concatenated_audio.shape) # Debug statement
|
94 |
concatenated_audio = concatenated_audio / np.max(np.abs(concatenated_audio))
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
|
97 |
with gr.Blocks() as demo:
|
98 |
gr.Markdown(title)
|
|
|
89 |
audio_np = generate_segment_audio(text_str, lang, speaker_url, pipe)
|
90 |
print("Audio segment shape:", audio_np.shape) # Debug statement
|
91 |
audio_segments.append(audio_np)
|
92 |
+
# Normalize the concatenated audio
|
|
|
93 |
concatenated_audio = concatenated_audio / np.max(np.abs(concatenated_audio))
|
94 |
+
|
95 |
+
# Write the audio data to a temporary file and return the file path
|
96 |
+
with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as tmp_file:
|
97 |
+
sf.write(tmp_file.name, concatenated_audio.T, 24000, format='WAV', subtype='PCM_16')
|
98 |
+
return tmp_file.name
|
99 |
|
100 |
with gr.Blocks() as demo:
|
101 |
gr.Markdown(title)
|