Spaces:
Running
on
A10G
Running
on
A10G
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from evaluate import eval, install
|
3 |
from datetime import datetime
|
4 |
-
import os, shutil
|
5 |
import warnings, tempfile
|
6 |
from audio import gen_audio
|
7 |
warnings.filterwarnings("ignore")
|
@@ -44,16 +44,18 @@ jsons = {
|
|
44 |
def get_video_url(option):
|
45 |
return videos[option]
|
46 |
|
47 |
-
@spaces.GPU()
|
48 |
def evaluate_sign_language(user_video, standard_video_option):
|
49 |
tmp = tempfile.TemporaryDirectory()
|
50 |
tmpdir = tmp.name
|
51 |
new_path = tmpdir + "/user.mp4"
|
52 |
shutil.copy(user_video, new_path)
|
53 |
shutil.copy(videos[standard_video_option], tmpdir + "/standard.mp4")
|
|
|
54 |
print("Copy User Video to:", new_path)
|
55 |
print("Copy Standard Video to:", tmpdir + "/standard.mp4")
|
56 |
-
|
|
|
57 |
test, standard = user_video, videos[standard_video_option]
|
58 |
score, final_merged_intervals, comments = eval(test, standard, tmpdir)
|
59 |
|
@@ -110,7 +112,7 @@ def cleanup_temp_dir(tmp_dir):
|
|
110 |
return "临时目录已清理"
|
111 |
return "没有临时目录需要清理"
|
112 |
|
113 |
-
install()
|
114 |
font = ["Heiti SC", "FangSong"]
|
115 |
title = """<h1 style="text-align: center;">
|
116 |
<div style="width: 1.4em; height: 1.4em; display: inline-block;"><img src="https://github.com/ZiyuGuo99/ZiyuGuo99.github.io/blob/main/assets/img/sl.png?raw=true" style='width: 100%; height: 100%; object-fit: contain;' /></div>
|
|
|
1 |
import gradio as gr
|
2 |
from evaluate import eval, install
|
3 |
from datetime import datetime
|
4 |
+
import os, shutil #, spaces
|
5 |
import warnings, tempfile
|
6 |
from audio import gen_audio
|
7 |
warnings.filterwarnings("ignore")
|
|
|
44 |
def get_video_url(option):
|
45 |
return videos[option]
|
46 |
|
47 |
+
# @spaces.GPU()
|
48 |
def evaluate_sign_language(user_video, standard_video_option):
|
49 |
tmp = tempfile.TemporaryDirectory()
|
50 |
tmpdir = tmp.name
|
51 |
new_path = tmpdir + "/user.mp4"
|
52 |
shutil.copy(user_video, new_path)
|
53 |
shutil.copy(videos[standard_video_option], tmpdir + "/standard.mp4")
|
54 |
+
shutil.copy(jsons[standard_video_option], tmpdir + "/standard.json")
|
55 |
print("Copy User Video to:", new_path)
|
56 |
print("Copy Standard Video to:", tmpdir + "/standard.mp4")
|
57 |
+
print("Copy Standard JSON to:", tmpdir + "/standard.json")
|
58 |
+
|
59 |
test, standard = user_video, videos[standard_video_option]
|
60 |
score, final_merged_intervals, comments = eval(test, standard, tmpdir)
|
61 |
|
|
|
112 |
return "临时目录已清理"
|
113 |
return "没有临时目录需要清理"
|
114 |
|
115 |
+
# install()
|
116 |
font = ["Heiti SC", "FangSong"]
|
117 |
title = """<h1 style="text-align: center;">
|
118 |
<div style="width: 1.4em; height: 1.4em; display: inline-block;"><img src="https://github.com/ZiyuGuo99/ZiyuGuo99.github.io/blob/main/assets/img/sl.png?raw=true" style='width: 100%; height: 100%; object-fit: contain;' /></div>
|