Liusuthu commited on
Commit
3b52837
Β·
verified Β·
1 Parent(s): be20cf1

Update app_utils.py

Browse files
Files changed (1) hide show
  1. app_utils.py +7 -10
app_utils.py CHANGED
@@ -18,7 +18,7 @@ import torchaudio
18
  from speechbrain.pretrained.interfaces import foreign_class
19
  from paraformer import AudioReader, CttPunctuator, FSMNVad, ParaformerOffline
20
  from gradio_client import Client
21
-
22
  ##############################################################################################
23
  client = Client("Liusuthu/TextDepression")
24
 
@@ -282,7 +282,7 @@ def video_score(video):
282
 
283
 
284
  #ζ‰“εˆ†ε‡½ζ•°
285
- def video_test(video):
286
 
287
  cap = cv2.VideoCapture(video)
288
  w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
@@ -441,14 +441,11 @@ def video_test(video):
441
  my_audio_clip.write_audiofile("data/audio.wav",ffmpeg_params=["-ac","1"])
442
 
443
  audio = wav.read('data/audio.wav')
444
- text,prob2,label,path=classify_continuous(audio)
445
-
446
- score2=10*prob2[0]-10*prob2[1]
447
- print(prob2,label,path)
448
- print("score2=",score2)
449
 
450
- text_result=str(get_text_score(text))
451
- print(text_result)
 
452
 
 
453
 
454
- return stat,score1,"data/audio.wav",score2,text_result
 
18
  from speechbrain.pretrained.interfaces import foreign_class
19
  from paraformer import AudioReader, CttPunctuator, FSMNVad, ParaformerOffline
20
  from gradio_client import Client
21
+ from consult import speech_score
22
  ##############################################################################################
23
  client = Client("Liusuthu/TextDepression")
24
 
 
282
 
283
 
284
  #ζ‰“εˆ†ε‡½ζ•°
285
+ def video_score(video):
286
 
287
  cap = cv2.VideoCapture(video)
288
  w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
 
441
  my_audio_clip.write_audiofile("data/audio.wav",ffmpeg_params=["-ac","1"])
442
 
443
  audio = wav.read('data/audio.wav')
 
 
 
 
 
444
 
445
+ text,socre2=speech_score(audio)
446
+
447
+ print(text)
448
 
449
+ score=score2+score1
450
 
451
+ return text,score