XDHDD commited on
Commit
264274f
1 Parent(s): 9de3656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -18,13 +18,6 @@ import torchaudio
18
 
19
  from torch_pesq import PesqLoss
20
 
21
- pesq = PesqLoss(0.5,
22
- sample_rate=44100,
23
- )
24
-
25
- mos = pesq.mos(reference, degraded)
26
- loss = pesq(reference, degraded)
27
-
28
 
29
  @st.cache
30
  def load_model():
@@ -154,16 +147,25 @@ if st.button('Сгенерировать потери'):
154
  stoi_mass=[stoi_orig, stoi_lossy, stoi_enhanced]
155
 
156
 
 
 
157
  #if samplerate != 16000:
158
  # data_lossy = librosa.resample(data_lossy, orig_sr=48000, target_sr=16000)
159
  # data_clean = librosa.resample(data_clean, orig_sr=48000, target_sr=16000)
160
  # data_enhanced = librosa.resample(data_enhanced, orig_sr=48000, target_sr=16000)
161
- #
 
 
 
 
 
 
 
162
  #pesq_orig = pesq(fs = 16000, ref = data_clean, deg = data_clean, mode='nb')
163
  #pesq_lossy = pesq(fs = 16000, ref = data_clean, deg = data_lossy, mode='nb')
164
  #pesq_enhanced = pesq(fs = 16000, ref = data_clean, deg = data_enhanced, mode='nb')
165
 
166
- #psq_mas=[pesq_orig, pesq_lossy, pesq_enhanced]
167
 
168
 
169
 
@@ -171,7 +173,7 @@ if st.button('Сгенерировать потери'):
171
 
172
  df['Audio'] = ['Clean', 'Lossy', 'Enhanced']
173
 
174
- #df['PESQ'] = psq_mas
175
 
176
  df['STOI'] = stoi_mass
177
 
 
18
 
19
  from torch_pesq import PesqLoss
20
 
 
 
 
 
 
 
 
21
 
22
  @st.cache
23
  def load_model():
 
147
  stoi_mass=[stoi_orig, stoi_lossy, stoi_enhanced]
148
 
149
 
150
+
151
+
152
  #if samplerate != 16000:
153
  # data_lossy = librosa.resample(data_lossy, orig_sr=48000, target_sr=16000)
154
  # data_clean = librosa.resample(data_clean, orig_sr=48000, target_sr=16000)
155
  # data_enhanced = librosa.resample(data_enhanced, orig_sr=48000, target_sr=16000)
156
+ #
157
+
158
+ pesq = PesqLoss(0.5, sample_rate=48000)
159
+
160
+ pesq_orig = pesq.mos(data_clean, data_clean)
161
+ pesq_lossy = pesq.mos(data_clean, data_lossy)
162
+ pesq_enhanced= pesq.mos(data_clean, data_enhanced)
163
+
164
  #pesq_orig = pesq(fs = 16000, ref = data_clean, deg = data_clean, mode='nb')
165
  #pesq_lossy = pesq(fs = 16000, ref = data_clean, deg = data_lossy, mode='nb')
166
  #pesq_enhanced = pesq(fs = 16000, ref = data_clean, deg = data_enhanced, mode='nb')
167
 
168
+ psq_mas=[pesq_orig, pesq_lossy, pesq_enhanced]
169
 
170
 
171
 
 
173
 
174
  df['Audio'] = ['Clean', 'Lossy', 'Enhanced']
175
 
176
+ df['PESQ'] = psq_mas
177
 
178
  df['STOI'] = stoi_mass
179