Spaces:
Running
on
A10G
Running
on
A10G
Update app.py
Browse files
app.py
CHANGED
@@ -45,14 +45,15 @@ def get_video_url(option):
|
|
45 |
return videos[option]
|
46 |
|
47 |
def evaluate_sign_language(user_video, standard_video_option):
|
48 |
-
|
|
|
49 |
# 将文件从临时路径复制到新路径
|
50 |
shutil.copy(user_video, new_path)
|
51 |
-
shutil.copy(videos[standard_video_option], "
|
52 |
-
shutil.copy(jsons[standard_video_option], "
|
53 |
######
|
54 |
test, standard = user_video, videos[standard_video_option]
|
55 |
-
score, final_merged_intervals, comments = eval(test, standard)
|
56 |
# return None # comment if NOT produce standard json files
|
57 |
|
58 |
if score < 95:
|
@@ -97,7 +98,7 @@ def evaluate_sign_language(user_video, standard_video_option):
|
|
97 |
advice += "<br>建議:請參考標準視頻,模仿正確的動作,保持速度一致。<br><br>"
|
98 |
advice += f"<b>綜合評分:</b> 您本次的總評分為 {score:.2f}/100分。<br>"
|
99 |
|
100 |
-
ret_video = gen_audio(subtitles)
|
101 |
return advice, ret_video
|
102 |
|
103 |
font = ["Heiti SC", "FangSong"]
|
|
|
45 |
return videos[option]
|
46 |
|
47 |
def evaluate_sign_language(user_video, standard_video_option):
|
48 |
+
tmpdir = tempfile.TemporaryDirectory()
|
49 |
+
new_path = tmpdir + "/user.mp4"
|
50 |
# 将文件从临时路径复制到新路径
|
51 |
shutil.copy(user_video, new_path)
|
52 |
+
shutil.copy(videos[standard_video_option], tmpdir + "/standard.mp4")
|
53 |
+
shutil.copy(jsons[standard_video_option], tmpdir + "/standard.json") #comment if produce standard json files
|
54 |
######
|
55 |
test, standard = user_video, videos[standard_video_option]
|
56 |
+
score, final_merged_intervals, comments = eval(test, standard, tmpdir)
|
57 |
# return None # comment if NOT produce standard json files
|
58 |
|
59 |
if score < 95:
|
|
|
98 |
advice += "<br>建議:請參考標準視頻,模仿正確的動作,保持速度一致。<br><br>"
|
99 |
advice += f"<b>綜合評分:</b> 您本次的總評分為 {score:.2f}/100分。<br>"
|
100 |
|
101 |
+
ret_video = gen_audio(subtitles, tmpdir)
|
102 |
return advice, ret_video
|
103 |
|
104 |
font = ["Heiti SC", "FangSong"]
|