Spaces:
Runtime error
Runtime error
Commit
·
9362e89
1
Parent(s):
664fd56
Upload 3 files
Browse files- app.py +18 -7
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
-
from voicefixer
|
2 |
import streamlit as st
|
3 |
from audio_recorder_streamlit import audio_recorder
|
4 |
from io import BytesIO
|
5 |
import soundfile as sf
|
|
|
6 |
|
7 |
st.set_page_config(page_title="VoiceFixer app", page_icon=":notes:")
|
|
|
8 |
st.title("Voice Fixer App :notes:")
|
9 |
st.write(
|
10 |
"""
|
@@ -21,17 +23,26 @@ audio_bytes = audio_recorder(
|
|
21 |
)
|
22 |
try:
|
23 |
data, samplerate = sf.read(BytesIO(audio_bytes))
|
24 |
-
print(samplerate)
|
25 |
sf.write("original.wav",data,samplerate)
|
26 |
st.audio(audio_bytes, format = "audio/wav")
|
27 |
if data.shape[0]>=10000:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
voicefixer.restore(input="original.wav", # low quality .wav/.flac file
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
st.write("The Audio without background noises and a little enhancement :ocean:")
|
33 |
st.audio("enhanced_output.wav")
|
34 |
-
|
35 |
else: st.warning("Recorded Audio is too short, try again :relieved:")#wink
|
36 |
except:
|
37 |
st.info("Try to record some audio :relieved:")
|
|
|
1 |
+
from voicefixer import VoiceFixer
|
2 |
import streamlit as st
|
3 |
from audio_recorder_streamlit import audio_recorder
|
4 |
from io import BytesIO
|
5 |
import soundfile as sf
|
6 |
+
# import noisereduce as nr
|
7 |
|
8 |
st.set_page_config(page_title="VoiceFixer app", page_icon=":notes:")
|
9 |
+
|
10 |
st.title("Voice Fixer App :notes:")
|
11 |
st.write(
|
12 |
"""
|
|
|
23 |
)
|
24 |
try:
|
25 |
data, samplerate = sf.read(BytesIO(audio_bytes))
|
26 |
+
#print(samplerate)
|
27 |
sf.write("original.wav",data,samplerate)
|
28 |
st.audio(audio_bytes, format = "audio/wav")
|
29 |
if data.shape[0]>=10000:
|
30 |
+
# reduced_noise = nr.reduce_noise(
|
31 |
+
# y= (data[:,0]+data[:,1])/2.0,#data[:,0],#, data X,Should be a single channel
|
32 |
+
# sr=samplerate,
|
33 |
+
# n_fft=512, #512 recommended for speech, 1024 default
|
34 |
+
# stationary=False,
|
35 |
+
# )
|
36 |
+
# st.write("[Classic] Background noise reduction:")
|
37 |
+
# st.audio(reduced_noise, sample_rate=samplerate)
|
38 |
+
|
39 |
voicefixer.restore(input="original.wav", # low quality .wav/.flac file
|
40 |
+
output="enhanced_output.wav",
|
41 |
+
cuda=False, # GPU acceleration
|
42 |
+
mode=0)
|
43 |
+
st.write("[Deep] The Audio without background noises and a little enhancement :ocean:")
|
44 |
st.audio("enhanced_output.wav")
|
45 |
+
|
46 |
else: st.warning("Recorded Audio is too short, try again :relieved:")#wink
|
47 |
except:
|
48 |
st.info("Try to record some audio :relieved:")
|
requirements.txt
CHANGED
@@ -8,4 +8,5 @@ progressbar
|
|
8 |
torchlibrosa==0.0.7
|
9 |
GitPython
|
10 |
streamlit>=1.12.
|
11 |
-
pyyaml
|
|
|
|
8 |
torchlibrosa==0.0.7
|
9 |
GitPython
|
10 |
streamlit>=1.12.
|
11 |
+
pyyaml
|
12 |
+
# noisereduce
|