khalida1wwin
commited on
Commit
·
8d6521c
1
Parent(s):
14f247d
update app.py
Browse files
app.py
CHANGED
@@ -189,15 +189,26 @@ audio_output_prediction, sample_rate, min_duration, frame_length, hop_length_fra
|
|
189 |
print(audio_output_prediction)
|
190 |
sf.write(audio_output_prediction , denoise_long[0, :], sample_rate)
|
191 |
|
192 |
-
def denoise_audio(audioName):
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
|
|
201 |
t = len_data / sample_rate # returns duration but in floats
|
202 |
print("t:",t)
|
203 |
weights_path = os.path.abspath("./")
|
@@ -216,7 +227,7 @@ def denoise_audio(audioName):
|
|
216 |
dim_square_spec = int(n_fft / 2) + 1
|
217 |
|
218 |
prediction(weights_path, name_model, audio_dir_prediction, dir_save_prediction, audio_input_prediction,
|
219 |
-
|
220 |
print(audio_output_prediction)
|
221 |
return audio_output_prediction
|
222 |
|
|
|
189 |
print(audio_output_prediction)
|
190 |
sf.write(audio_output_prediction , denoise_long[0, :], sample_rate)
|
191 |
|
192 |
+
def denoise_audio(audioName,mic):
|
193 |
+
if audioName != 0:
|
194 |
+
sr, data = audioName
|
195 |
+
sf.write("temp.wav",data, sr)
|
196 |
+
testNo = "temp"
|
197 |
+
audio_dir_prediction = os.path.abspath("/")+ str(testNo) +".wav"
|
198 |
+
sample_rate, data = audioName[0], audioName[1]
|
199 |
+
len_data = len(data) # holds length of the numpy array
|
200 |
+
|
201 |
+
|
202 |
+
|
203 |
+
else:
|
204 |
+
sr, data = mic
|
205 |
+
sf.write("temp.wav",data, sr)
|
206 |
+
testNo = "temp"
|
207 |
+
audio_dir_prediction = os.path.abspath("/")+ str(testNo) +".wav"
|
208 |
+
sample_rate, data = mic[0], mic[1]
|
209 |
+
len_data = len(data)
|
210 |
|
211 |
+
|
212 |
t = len_data / sample_rate # returns duration but in floats
|
213 |
print("t:",t)
|
214 |
weights_path = os.path.abspath("./")
|
|
|
227 |
dim_square_spec = int(n_fft / 2) + 1
|
228 |
|
229 |
prediction(weights_path, name_model, audio_dir_prediction, dir_save_prediction, audio_input_prediction,
|
230 |
+
audio_output_prediction, sample_rate, min_duration, frame_length, hop_length_frame, n_fft, hop_length_fft)
|
231 |
print(audio_output_prediction)
|
232 |
return audio_output_prediction
|
233 |
|