XDHDD commited on
Commit
41a0245
1 Parent(s): a0cec93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -296,18 +296,40 @@ if st.button('Сгенерировать потери'):
296
 
297
  r = speech_r.Recognizer()
298
 
 
 
 
299
  harvard = speech_r.AudioFile('target.wav')
300
  with harvard as source:
301
  audio = r.record(source)
302
 
303
  orig = r.recognize_google(audio, language = "ru-RU")
304
 
 
 
 
 
 
305
  harvard = speech_r.AudioFile('lossy.wav')
306
  with harvard as source:
307
  audio = r.record(source)
308
  lossy = r.recognize_google(audio, language = "ru-RU")
309
 
 
 
 
 
 
 
 
 
 
 
 
310
 
 
 
 
311
  harvard = speech_r.AudioFile('enhanced.wav')
312
  with harvard as source:
313
  audio = r.record(source)
@@ -316,14 +338,14 @@ if st.button('Сгенерировать потери'):
316
  error1 = wer(orig, orig)
317
  error2 = wer(orig, lossy)
318
  error3 = wer(orig, enhanced)
319
- #WER_mass=[error1*100, error2*100, error3*100]
320
 
321
  print(orig)
322
  print(lossy)
323
  print(enhanced)
324
  st.text(orig)
325
  st.text(lossy)
326
- #df_1['WER'] = WER_mass
327
 
328
  st.dataframe(df_1)
329
 
 
296
 
297
  r = speech_r.Recognizer()
298
 
299
+
300
+
301
+
302
  harvard = speech_r.AudioFile('target.wav')
303
  with harvard as source:
304
  audio = r.record(source)
305
 
306
  orig = r.recognize_google(audio, language = "ru-RU")
307
 
308
+
309
+
310
+
311
+
312
+
313
  harvard = speech_r.AudioFile('lossy.wav')
314
  with harvard as source:
315
  audio = r.record(source)
316
  lossy = r.recognize_google(audio, language = "ru-RU")
317
 
318
+ try:
319
+ with harvard as source:
320
+ audio = r.record(source)
321
+ lossy = recognizer.recognize_google(audio)
322
+ #print("Распознанный текст:", text)
323
+ except sr.UnknownValueError:
324
+ print("Система не смогла распознать аудио")
325
+ lossy = ''
326
+ except sr.RequestError as e:
327
+ print("Ошибка при запросе к сервису распознавания речи; {0}".format(e))
328
+
329
 
330
+
331
+
332
+
333
  harvard = speech_r.AudioFile('enhanced.wav')
334
  with harvard as source:
335
  audio = r.record(source)
 
338
  error1 = wer(orig, orig)
339
  error2 = wer(orig, lossy)
340
  error3 = wer(orig, enhanced)
341
+ WER_mass=[error1*100, error2*100, error3*100]
342
 
343
  print(orig)
344
  print(lossy)
345
  print(enhanced)
346
  st.text(orig)
347
  st.text(lossy)
348
+ df_1['WER'] = WER_mass
349
 
350
  st.dataframe(df_1)
351