Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -94,12 +94,13 @@ def whisper_speech_demo(multilingual_text, speaker_audio):
|
|
| 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 |
-
#
|
| 102 |
-
|
|
|
|
|
|
|
| 103 |
|
| 104 |
with gr.Blocks() as demo:
|
| 105 |
gr.Markdown(title)
|
|
|
|
| 94 |
|
| 95 |
concatenated_audio = concatenate_audio_segments(audio_segments)
|
| 96 |
print("Final concatenated audio shape:", concatenated_audio.shape) # Debug statement
|
|
|
|
| 97 |
# Normalize the concatenated audio
|
| 98 |
concatenated_audio = concatenated_audio / np.max(np.abs(concatenated_audio))
|
| 99 |
|
| 100 |
+
# Write the audio data to a temporary file and return the file path
|
| 101 |
+
with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as tmp_file:
|
| 102 |
+
sf.write(tmp_file.name, concatenated_audio.T, 24000, format='WAV', subtype='PCM_16')
|
| 103 |
+
return tmp_file.name
|
| 104 |
|
| 105 |
with gr.Blocks() as demo:
|
| 106 |
gr.Markdown(title)
|