Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -37,11 +37,10 @@ def whisper_speech_demo(text, lang, speaker_audio, mix_lang, mix_text):
|
|
37 |
audio_data_resampled = next(resample_audio([{'sample_rate': 24000, 'samples': audio_data.cpu()}]))['samples_24k']
|
38 |
audio_np = audio_data_resampled.cpu().numpy()
|
39 |
audio_np = audio_np / np.max(np.abs(audio_np))
|
40 |
-
audio_np = np.asarray(audio_np, dtype=np.float32)
|
41 |
-
|
42 |
audio_stereo = np.stack((audio_np, audio_np), axis=-1)
|
43 |
-
|
44 |
with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as tmp_file:
|
|
|
45 |
sf.write(tmp_file.name, audio_stereo, 24000, format='WAV', subtype='PCM_16')
|
46 |
return tmp_file.name
|
47 |
|
|
|
37 |
audio_data_resampled = next(resample_audio([{'sample_rate': 24000, 'samples': audio_data.cpu()}]))['samples_24k']
|
38 |
audio_np = audio_data_resampled.cpu().numpy()
|
39 |
audio_np = audio_np / np.max(np.abs(audio_np))
|
40 |
+
audio_np = np.asarray(audio_np, dtype=np.float32)
|
|
|
41 |
audio_stereo = np.stack((audio_np, audio_np), axis=-1)
|
|
|
42 |
with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as tmp_file:
|
43 |
+
# Write the stereo data with a sample rate of 24000 Hz
|
44 |
sf.write(tmp_file.name, audio_stereo, 24000, format='WAV', subtype='PCM_16')
|
45 |
return tmp_file.name
|
46 |
|