Spaces:
Runtime error
Runtime error
Update app_utils.py
Browse files- app_utils.py +13 -1
app_utils.py
CHANGED
@@ -271,7 +271,7 @@ def video_score(video):
|
|
271 |
|
272 |
|
273 |
|
274 |
-
|
275 |
def video_test(video):
|
276 |
|
277 |
cap = cv2.VideoCapture(video)
|
@@ -417,6 +417,7 @@ def video_test(video):
|
|
417 |
scores=[s1,s2,s3,s4,s5,s6,s7]
|
418 |
scores_str=str(scores)
|
419 |
score1=0*scores[0]-8*scores[1]+4*scores[2]+0*scores[3]+2*scores[4]+2*scores[5]+4*scores[6]
|
|
|
420 |
with open("local_data/data.txt",'a', encoding="utf8") as f:
|
421 |
f.write(scores_str+'\n')
|
422 |
|
@@ -428,5 +429,16 @@ def video_test(video):
|
|
428 |
#trans the audio file
|
429 |
my_audio_clip = AudioFileClip(video)
|
430 |
my_audio_clip.write_audiofile("data/audio.wav",ffmpeg_params=["-ac","1"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
|
432 |
return stat,score1,"data/audio.wav"
|
|
|
271 |
|
272 |
|
273 |
|
274 |
+
#打分函数
|
275 |
def video_test(video):
|
276 |
|
277 |
cap = cv2.VideoCapture(video)
|
|
|
417 |
scores=[s1,s2,s3,s4,s5,s6,s7]
|
418 |
scores_str=str(scores)
|
419 |
score1=0*scores[0]-8*scores[1]+4*scores[2]+0*scores[3]+2*scores[4]+2*scores[5]+4*scores[6]
|
420 |
+
print("score1=",score1)
|
421 |
with open("local_data/data.txt",'a', encoding="utf8") as f:
|
422 |
f.write(scores_str+'\n')
|
423 |
|
|
|
429 |
#trans the audio file
|
430 |
my_audio_clip = AudioFileClip(video)
|
431 |
my_audio_clip.write_audiofile("data/audio.wav",ffmpeg_params=["-ac","1"])
|
432 |
+
|
433 |
+
Audio="data/audio.wav"
|
434 |
+
text,prob2,label,path=classify_continuous(Audio)
|
435 |
+
|
436 |
+
score2=10*prob2[0]-10*prob[1]
|
437 |
+
print(prob2,label,path)
|
438 |
+
print("score2=",score2)
|
439 |
+
|
440 |
+
text_result=text_api(text)
|
441 |
+
print(text_result)
|
442 |
+
|
443 |
|
444 |
return stat,score1,"data/audio.wav"
|