Spaces:
Runtime error
Runtime error
Xu Ma
commited on
Commit
•
434282c
1
Parent(s):
e792874
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import argparse
|
2 |
import csv
|
3 |
import sys
|
|
|
4 |
from pathlib import Path
|
5 |
|
6 |
import gradio as gr
|
@@ -142,6 +143,7 @@ run_cmd("ls")
|
|
142 |
run_cmd("git submodule update --init --recursive")
|
143 |
run_cmd("python setup.py install --user")
|
144 |
run_cmd("ls")
|
|
|
145 |
|
146 |
|
147 |
|
@@ -171,27 +173,6 @@ def yaml_csv(file_path, file_tag):
|
|
171 |
|
172 |
def main(args):
|
173 |
gr.close_all()
|
174 |
-
|
175 |
-
global model
|
176 |
-
|
177 |
-
slider_step = 0.05 # 滑动步长
|
178 |
-
|
179 |
-
nms_conf = args.nms_conf
|
180 |
-
nms_iou = args.nms_iou
|
181 |
-
label_opt = args.label_dnt_show
|
182 |
-
model_name = args.model_name
|
183 |
-
model_cfg = args.model_cfg
|
184 |
-
cls_name = args.cls_name
|
185 |
-
device = args.device
|
186 |
-
inference_size = args.inference_size
|
187 |
-
|
188 |
-
# 模型加载
|
189 |
-
model = model_loading(model_name, device)
|
190 |
-
|
191 |
-
model_names = yaml_csv(model_cfg, "model_names")
|
192 |
-
model_cls_name = yaml_csv(cls_name, "model_cls_name")
|
193 |
-
|
194 |
-
|
195 |
# -------------------Inputs-------------------
|
196 |
inputs_img = gr.inputs.Image(type="pil", label="Input Image")
|
197 |
experiment_id = gr.inputs.Radio(
|
@@ -202,52 +183,21 @@ def main(args):
|
|
202 |
"add [1,2,4,8,16,32, ...] total 256 paths"], type="value", default="add [1,1,1,1,1] paths", label="Path Adding Scheduler"
|
203 |
)
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
device = gr.inputs.Dropdown(
|
210 |
-
choices=["cpu"], default=device, type="value", label="设备"
|
211 |
-
)
|
212 |
-
inputs_model = gr.inputs.Dropdown(
|
213 |
-
choices=model_names, default=model_name, type="value", label="模型"
|
214 |
-
)
|
215 |
-
inputs_size = gr.inputs.Radio(
|
216 |
-
choices=[320, 640], default=inference_size, label="推理尺寸"
|
217 |
-
)
|
218 |
-
input_conf = gr.inputs.Slider(
|
219 |
-
0, 1, step=slider_step, default=nms_conf, label="置信度阈值"
|
220 |
-
)
|
221 |
-
inputs_iou = gr.inputs.Slider(
|
222 |
-
0, 1, step=slider_step, default=nms_iou, label="IoU 阈值"
|
223 |
-
)
|
224 |
-
inputs_label = gr.inputs.Checkbox(default=label_opt, label="标签显示")
|
225 |
-
inputs_clsName = gr.inputs.CheckboxGroup(
|
226 |
-
choices=model_cls_name, default=model_cls_name, type="index", label="类别"
|
227 |
-
)
|
228 |
-
|
229 |
-
# 输入参数
|
230 |
inputs = [
|
231 |
-
inputs_img, #
|
232 |
experiment_id, # path adding scheduler
|
233 |
-
# device, # 设备
|
234 |
-
# inputs_model, # 模型
|
235 |
-
# inputs_size, # 推理尺寸
|
236 |
-
# input_conf, # 置信度阈值
|
237 |
-
# inputs_iou, # IoU阈值
|
238 |
-
# inputs_label, # 标签显示
|
239 |
-
# inputs_clsName, # 类别
|
240 |
]
|
241 |
-
#
|
242 |
outputs = gr.outputs.Image(type="pil", label="检测图片")
|
243 |
outputs02 = gr.outputs.JSON(label="检测信息")
|
244 |
|
245 |
-
#
|
246 |
title = "LIVE: Towards Layer-wise Image Vectorization"
|
247 |
-
#
|
248 |
description = "<div align='center'>(CVPR 2022 Oral Presentation)</div>"
|
249 |
|
250 |
-
#
|
251 |
examples = [
|
252 |
[
|
253 |
"./examples/1.png",
|
@@ -271,7 +221,7 @@ def main(args):
|
|
271 |
],
|
272 |
]
|
273 |
|
274 |
-
#
|
275 |
gr.Interface(
|
276 |
fn=yolo_det,
|
277 |
inputs=inputs,
|
|
|
1 |
import argparse
|
2 |
import csv
|
3 |
import sys
|
4 |
+
sys.path.append("./LIVE")
|
5 |
from pathlib import Path
|
6 |
|
7 |
import gradio as gr
|
|
|
143 |
run_cmd("git submodule update --init --recursive")
|
144 |
run_cmd("python setup.py install --user")
|
145 |
run_cmd("ls")
|
146 |
+
run_cmd("python main.py --config config/base.yaml --experiment experiment_5x1 --signature smile --target figures/smile.png --log_dir log/")
|
147 |
|
148 |
|
149 |
|
|
|
173 |
|
174 |
def main(args):
|
175 |
gr.close_all()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
# -------------------Inputs-------------------
|
177 |
inputs_img = gr.inputs.Image(type="pil", label="Input Image")
|
178 |
experiment_id = gr.inputs.Radio(
|
|
|
183 |
"add [1,2,4,8,16,32, ...] total 256 paths"], type="value", default="add [1,1,1,1,1] paths", label="Path Adding Scheduler"
|
184 |
)
|
185 |
|
186 |
+
# inputs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
inputs = [
|
188 |
+
inputs_img, # input image
|
189 |
experiment_id, # path adding scheduler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
]
|
191 |
+
# outputs
|
192 |
outputs = gr.outputs.Image(type="pil", label="检测图片")
|
193 |
outputs02 = gr.outputs.JSON(label="检测信息")
|
194 |
|
195 |
+
# title
|
196 |
title = "LIVE: Towards Layer-wise Image Vectorization"
|
197 |
+
# description
|
198 |
description = "<div align='center'>(CVPR 2022 Oral Presentation)</div>"
|
199 |
|
200 |
+
# examples
|
201 |
examples = [
|
202 |
[
|
203 |
"./examples/1.png",
|
|
|
221 |
],
|
222 |
]
|
223 |
|
224 |
+
# Interface
|
225 |
gr.Interface(
|
226 |
fn=yolo_det,
|
227 |
inputs=inputs,
|