Spaces:
Sleeping
Sleeping
ASG Models
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,15 +17,25 @@ def Read_DataSet(link):
|
|
| 17 |
return df
|
| 18 |
|
| 19 |
|
|
|
|
| 20 |
def remove_nn(wav, sample_rate=16000):
|
| 21 |
-
|
| 22 |
-
audio
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
enhanced = enhance(model_enhance, df_state, audio)
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
return 16000, audiodata
|
| 27 |
|
| 28 |
|
|
|
|
|
|
|
| 29 |
class DataViewerApp:
|
| 30 |
def __init__(self,df):
|
| 31 |
#df=Read_DataSet(link)
|
|
@@ -80,8 +90,9 @@ class DataViewerApp:
|
|
| 80 |
self.data.iloc[self.current_selected] = row
|
| 81 |
sr,audio=data_oudio
|
| 82 |
if sr!=16000:
|
| 83 |
-
|
| 84 |
-
audio
|
|
|
|
| 85 |
|
| 86 |
self.sdata[self.current_selected] = audio
|
| 87 |
return self.get_page_data(self.current_page)
|
|
|
|
| 17 |
return df
|
| 18 |
|
| 19 |
|
| 20 |
+
|
| 21 |
def remove_nn(wav, sample_rate=16000):
|
| 22 |
+
|
| 23 |
+
audio=librosa.resample(wav,orig_sr=sample_rate,target_sr=df_state.sr(),)
|
| 24 |
+
|
| 25 |
+
audio=torch.tensor([audio])
|
| 26 |
+
# audio, _ = load_audio('full_generation.wav', sr=df_state.sr())
|
| 27 |
+
print(audio)
|
| 28 |
+
|
| 29 |
enhanced = enhance(model_enhance, df_state, audio)
|
| 30 |
+
print(enhanced)
|
| 31 |
+
# save_audio("enhanced.wav", enhanced, df_state.sr())
|
| 32 |
+
audiodata=librosa.resample(enhanced.numpy(),orig_sr=df_state.sr(),target_sr=sample_rate)
|
| 33 |
+
|
| 34 |
return 16000, audiodata
|
| 35 |
|
| 36 |
|
| 37 |
+
|
| 38 |
+
|
| 39 |
class DataViewerApp:
|
| 40 |
def __init__(self,df):
|
| 41 |
#df=Read_DataSet(link)
|
|
|
|
| 90 |
self.data.iloc[self.current_selected] = row
|
| 91 |
sr,audio=data_oudio
|
| 92 |
if sr!=16000:
|
| 93 |
+
|
| 94 |
+
audio=librosa.resample(audio,orig_sr=sr,target_sr=16000)
|
| 95 |
+
|
| 96 |
|
| 97 |
self.sdata[self.current_selected] = audio
|
| 98 |
return self.get_page_data(self.current_page)
|