Spaces:
Runtime error
Runtime error
Xu Ma
commited on
Commit
•
99293cd
1
Parent(s):
e697003
update
Browse files- app.py +3 -2
- config/base.yaml +1 -1
- main.py +8 -0
app.py
CHANGED
@@ -297,13 +297,14 @@ def main(args):
|
|
297 |
experiment_id, # path adding scheduler
|
298 |
]
|
299 |
# outputs
|
300 |
-
outputs = gr.outputs.Image(type="
|
301 |
outputs02 = gr.outputs.JSON(label="检测信息")
|
302 |
|
303 |
# title
|
304 |
title = "LIVE: Towards Layer-wise Image Vectorization"
|
305 |
# description
|
306 |
-
description = "<div align='center'>(CVPR 2022 Oral Presentation)</div>"
|
|
|
307 |
|
308 |
# examples
|
309 |
examples = [
|
|
|
297 |
experiment_id, # path adding scheduler
|
298 |
]
|
299 |
# outputs
|
300 |
+
outputs = gr.outputs.Image(type="file", label="检测图片")
|
301 |
outputs02 = gr.outputs.JSON(label="检测信息")
|
302 |
|
303 |
# title
|
304 |
title = "LIVE: Towards Layer-wise Image Vectorization"
|
305 |
# description
|
306 |
+
description = "<div align='center'>(CVPR 2022 Oral Presentation)</div>" \
|
307 |
+
"<div align='center'>Without GPUs, it will cost longer time.</div>"
|
308 |
|
309 |
# examples
|
310 |
examples = [
|
config/base.yaml
CHANGED
@@ -8,7 +8,7 @@ default:
|
|
8 |
init: false
|
9 |
image: false
|
10 |
output: true
|
11 |
-
video:
|
12 |
loss: false
|
13 |
trainable:
|
14 |
bg: False
|
|
|
8 |
init: false
|
9 |
image: false
|
10 |
output: true
|
11 |
+
video: true
|
12 |
loss: false
|
13 |
trainable:
|
14 |
bg: False
|
main.py
CHANGED
@@ -503,6 +503,10 @@ def main_func(target, experiment, cfg_arg):
|
|
503 |
img = img[:, :, 3:4] * img[:, :, :3] + \
|
504 |
para_bg * (1 - img[:, :, 3:4])
|
505 |
|
|
|
|
|
|
|
|
|
506 |
if cfg.save.video:
|
507 |
filename = os.path.join(
|
508 |
cfg.experiment_dir, "video-png",
|
@@ -515,6 +519,10 @@ def main_func(target, experiment, cfg_arg):
|
|
515 |
imshow = img.detach().cpu()
|
516 |
pydiffvg.imwrite(imshow, filename, gamma=gamma)
|
517 |
|
|
|
|
|
|
|
|
|
518 |
x = img.unsqueeze(0).permute(0, 3, 1, 2) # HWC -> NCHW
|
519 |
|
520 |
if cfg.use_ycrcb:
|
|
|
503 |
img = img[:, :, 3:4] * img[:, :, :3] + \
|
504 |
para_bg * (1 - img[:, :, 3:4])
|
505 |
|
506 |
+
|
507 |
+
|
508 |
+
|
509 |
+
|
510 |
if cfg.save.video:
|
511 |
filename = os.path.join(
|
512 |
cfg.experiment_dir, "video-png",
|
|
|
519 |
imshow = img.detach().cpu()
|
520 |
pydiffvg.imwrite(imshow, filename, gamma=gamma)
|
521 |
|
522 |
+
### added for app
|
523 |
+
if t%10==0:
|
524 |
+
return filename, None
|
525 |
+
|
526 |
x = img.unsqueeze(0).permute(0, 3, 1, 2) # HWC -> NCHW
|
527 |
|
528 |
if cfg.use_ycrcb:
|