XDHDD commited on
Commit
c276eea
1 Parent(s): 215b1af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -11,13 +11,11 @@ import onnxruntime, onnx
11
  import matplotlib.pyplot as plt
12
  from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
13
  from pystoi import stoi
14
- #from pesq import pesq
15
  import pandas as pd
16
  import torchaudio
17
 
18
 
19
- from torch_pesq import PesqLoss
20
-
21
 
22
  @st.cache
23
  def load_model():
@@ -149,21 +147,16 @@ if st.button('Сгенерировать потери'):
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
 
 
11
  import matplotlib.pyplot as plt
12
  from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
13
  from pystoi import stoi
14
+ from pesq import pesq
15
  import pandas as pd
16
  import torchaudio
17
 
18
 
 
 
19
 
20
  @st.cache
21
  def load_model():
 
147
 
148
 
149
 
150
+ if samplerate != 16000:
151
+ data_lossy = librosa.resample(data_lossy, orig_sr=48000, target_sr=16000)
152
+ data_clean = librosa.resample(data_clean, orig_sr=48000, target_sr=16000)
153
+ data_enhanced = librosa.resample(data_enhanced, orig_sr=48000, target_sr=16000)
154
+
 
 
155
 
 
 
 
156
 
157
+ pesq_orig = pesq(fs = 16000, ref = data_clean, deg = data_clean, mode='nb')
158
+ pesq_lossy = pesq(fs = 16000, ref = data_clean, deg = data_lossy, mode='nb')
159
+ pesq_enhanced = pesq(fs = 16000, ref = data_clean, deg = data_enhanced, mode='nb')
160
 
161
  psq_mas=[pesq_orig, pesq_lossy, pesq_enhanced]
162