Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,7 +47,7 @@ def ui():
|
|
| 47 |
waveform_clean = waveform_clean.to(torch.double)
|
| 48 |
stft_clean = stft(waveform_clean)
|
| 49 |
st.text("Your uploaded audio")
|
| 50 |
-
st.audio(
|
| 51 |
#creating a mixture of our audio file and the noise file
|
| 52 |
waveform_mix = generate_mixture(waveform_clean, waveform_noise, target_snr)
|
| 53 |
#making the files into torch double format
|
|
@@ -58,7 +58,9 @@ def ui():
|
|
| 58 |
spec_img=plot_spectrogram(stft_mix)
|
| 59 |
st.image(spec_img,captions='Spectrogram of Mixture Speech (dB)')
|
| 60 |
#showing mixed audio in streamlit
|
| 61 |
-
|
|
|
|
|
|
|
| 62 |
#getting the irms
|
| 63 |
irm_speech, irm_noise = get_irms(stft_clean, stft_noise)
|
| 64 |
#getting the psd speech
|
|
@@ -70,7 +72,8 @@ def ui():
|
|
| 70 |
spec_clean_img=plot_spectrogram(stft_souden)
|
| 71 |
waveform_souden = waveform_souden.reshape(1, -1)
|
| 72 |
st.image(spec_clean_img,captions='Spectrogram of Mixture Speech (dB)')
|
| 73 |
-
|
|
|
|
| 74 |
|
| 75 |
if __name__=="__main__":
|
| 76 |
ui()
|
|
|
|
| 47 |
waveform_clean = waveform_clean.to(torch.double)
|
| 48 |
stft_clean = stft(waveform_clean)
|
| 49 |
st.text("Your uploaded audio")
|
| 50 |
+
st.audio(audio_file)
|
| 51 |
#creating a mixture of our audio file and the noise file
|
| 52 |
waveform_mix = generate_mixture(waveform_clean, waveform_noise, target_snr)
|
| 53 |
#making the files into torch double format
|
|
|
|
| 58 |
spec_img=plot_spectrogram(stft_mix)
|
| 59 |
st.image(spec_img,captions='Spectrogram of Mixture Speech (dB)')
|
| 60 |
#showing mixed audio in streamlit
|
| 61 |
+
|
| 62 |
+
torchaudio.save("./waveform_mix.wav", waveform_mix, sr)
|
| 63 |
+
st.audio("./waveform_mix.wav")
|
| 64 |
#getting the irms
|
| 65 |
irm_speech, irm_noise = get_irms(stft_clean, stft_noise)
|
| 66 |
#getting the psd speech
|
|
|
|
| 72 |
spec_clean_img=plot_spectrogram(stft_souden)
|
| 73 |
waveform_souden = waveform_souden.reshape(1, -1)
|
| 74 |
st.image(spec_clean_img,captions='Spectrogram of Mixture Speech (dB)')
|
| 75 |
+
torchaudio.save("./waveform_souden.wav", waveform_souden, sr)
|
| 76 |
+
st.audio("./waveform_souden.wav")
|
| 77 |
|
| 78 |
if __name__=="__main__":
|
| 79 |
ui()
|