XDHDD commited on
Commit
a7b8177
1 Parent(s): a430ff6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -156,16 +156,16 @@ if st.button('Сгенерировать потери'):
156
  stoi_mass=[stoi_orig, stoi_lossy, stoi_enhanced]
157
 
158
 
159
- pesq = PESQ(16000, 'nb')
160
 
161
  data_clean = data_clean.cpu().numpy()
162
  data_lossy = data_lossy.cpu().numpy()
163
  data_enhanced = data_enhanced.cpu().numpy()
164
 
165
- if samplerate != 16000:
166
- data_lossy = librosa.resample(data_lossy, orig_sr=48000, target_sr=16000)
167
- data_clean = librosa.resample(data_clean, orig_sr=48000, target_sr=16000)
168
- data_enhanced = librosa.resample(data_enhanced, orig_sr=48000, target_sr=16000)
169
 
170
  pesq_orig = float(pesq(torch.tensor(data_clean), torch.tensor(data_clean)))
171
  pesq_lossy = float(pesq(torch.tensor(data_lossy), torch.tensor(data_clean)))
 
156
  stoi_mass=[stoi_orig, stoi_lossy, stoi_enhanced]
157
 
158
 
159
+ pesq = PESQ(8000, 'nb')
160
 
161
  data_clean = data_clean.cpu().numpy()
162
  data_lossy = data_lossy.cpu().numpy()
163
  data_enhanced = data_enhanced.cpu().numpy()
164
 
165
+ if samplerate != 8000:
166
+ data_lossy = librosa.resample(data_lossy, orig_sr=48000, target_sr=8000)
167
+ data_clean = librosa.resample(data_clean, orig_sr=48000, target_sr=8000)
168
+ data_enhanced = librosa.resample(data_enhanced, orig_sr=48000, target_sr=8000)
169
 
170
  pesq_orig = float(pesq(torch.tensor(data_clean), torch.tensor(data_clean)))
171
  pesq_lossy = float(pesq(torch.tensor(data_lossy), torch.tensor(data_clean)))