Spaces:
Sleeping
Sleeping
ASG Models
commited on
Commit
•
68b9131
1
Parent(s):
0381da2
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ def Read_DataSet(link):
|
|
20 |
|
21 |
|
22 |
|
|
|
23 |
def remove_nn(wav, sample_rate=16000):
|
24 |
|
25 |
audio=librosa.resample(wav,orig_sr=sample_rate,target_sr=df_state.sr(),)
|
@@ -31,9 +32,9 @@ def remove_nn(wav, sample_rate=16000):
|
|
31 |
enhanced = enhance(model_enhance, df_state, audio)
|
32 |
print(enhanced)
|
33 |
# save_audio("enhanced.wav", enhanced, df_state.sr())
|
34 |
-
audiodata=librosa.resample(enhanced.numpy(),orig_sr=df_state.sr(),target_sr=sample_rate)
|
35 |
|
36 |
-
return 16000, audiodata
|
37 |
|
38 |
|
39 |
|
@@ -94,6 +95,8 @@ class DataViewerApp:
|
|
94 |
if sr!=16000:
|
95 |
|
96 |
audio=librosa.resample(audio,orig_sr=sr,target_sr=16000)
|
|
|
|
|
97 |
|
98 |
|
99 |
self.sdata[self.current_selected] = audio
|
|
|
20 |
|
21 |
|
22 |
|
23 |
+
|
24 |
def remove_nn(wav, sample_rate=16000):
|
25 |
|
26 |
audio=librosa.resample(wav,orig_sr=sample_rate,target_sr=df_state.sr(),)
|
|
|
32 |
enhanced = enhance(model_enhance, df_state, audio)
|
33 |
print(enhanced)
|
34 |
# save_audio("enhanced.wav", enhanced, df_state.sr())
|
35 |
+
audiodata=librosa.resample(enhanced[0].numpy(),orig_sr=df_state.sr(),target_sr=sample_rate)
|
36 |
|
37 |
+
return 16000, audiodata/np.max(audiodata)
|
38 |
|
39 |
|
40 |
|
|
|
95 |
if sr!=16000:
|
96 |
|
97 |
audio=librosa.resample(audio,orig_sr=sr,target_sr=16000)
|
98 |
+
audio=np.float32(audio)
|
99 |
+
audio/=np.max(audio)
|
100 |
|
101 |
|
102 |
self.sdata[self.current_selected] = audio
|