Spaces:
Runtime error
Runtime error
Xu Ma
commited on
Commit
•
e6e3a26
1
Parent(s):
0f6c050
update
Browse files
app.py
CHANGED
@@ -312,14 +312,14 @@ def main(args):
|
|
312 |
]
|
313 |
# outputs
|
314 |
outputs = gr.outputs.Image(type="numpy", label="Vectorized Image")
|
315 |
-
outputs02 = gr.outputs.
|
316 |
|
317 |
# title
|
318 |
title = "LIVE: Towards Layer-wise Image Vectorization"
|
319 |
# description
|
320 |
description = "<div align='center'>(CVPR 2022 Oral Presentation)</div>" \
|
321 |
"<div align='center'>Without GPUs, LIVE will cost longer time.</div>" \
|
322 |
-
"<div align='center'>For efficiency, we rescale
|
323 |
|
324 |
# examples
|
325 |
examples = [
|
|
|
312 |
]
|
313 |
# outputs
|
314 |
outputs = gr.outputs.Image(type="numpy", label="Vectorized Image")
|
315 |
+
outputs02 = gr.outputs.File(label="Generated SVG output")
|
316 |
|
317 |
# title
|
318 |
title = "LIVE: Towards Layer-wise Image Vectorization"
|
319 |
# description
|
320 |
description = "<div align='center'>(CVPR 2022 Oral Presentation)</div>" \
|
321 |
"<div align='center'>Without GPUs, LIVE will cost longer time.</div>" \
|
322 |
+
"<div align='center'>For efficiency, we rescale input to 160x160 (smaller size and fewer iterations will decrease the reconstructions).</div> "
|
323 |
|
324 |
# examples
|
325 |
examples = [
|
main.py
CHANGED
@@ -640,11 +640,13 @@ def main_func(target, experiment, num_iter, cfg_arg):
|
|
640 |
imshow = img.detach().cpu()
|
641 |
pydiffvg.imwrite(imshow, filename, gamma=gamma)
|
642 |
|
|
|
643 |
if cfg.save.output:
|
644 |
filename = os.path.join(
|
645 |
cfg.experiment_dir, "output-svg", "{}.svg".format(pathn_record_str))
|
646 |
check_and_create_dir(filename)
|
647 |
pydiffvg.save_svg(filename, w, h, shapes_record, shape_groups_record)
|
|
|
648 |
|
649 |
loss_matrix.append(loss_list)
|
650 |
|
@@ -693,7 +695,7 @@ def main_func(target, experiment, num_iter, cfg_arg):
|
|
693 |
# shutil.rmtree(os.path.join(cfg.experiment_dir, "video-png"))
|
694 |
|
695 |
print("The last loss is: {}".format(loss.item()))
|
696 |
-
return img.detach().cpu().numpy(),
|
697 |
|
698 |
|
699 |
if __name__ == "__main__":
|
|
|
640 |
imshow = img.detach().cpu()
|
641 |
pydiffvg.imwrite(imshow, filename, gamma=gamma)
|
642 |
|
643 |
+
svg_app_file_name = ""
|
644 |
if cfg.save.output:
|
645 |
filename = os.path.join(
|
646 |
cfg.experiment_dir, "output-svg", "{}.svg".format(pathn_record_str))
|
647 |
check_and_create_dir(filename)
|
648 |
pydiffvg.save_svg(filename, w, h, shapes_record, shape_groups_record)
|
649 |
+
svg_app_file_name = filename
|
650 |
|
651 |
loss_matrix.append(loss_list)
|
652 |
|
|
|
695 |
# shutil.rmtree(os.path.join(cfg.experiment_dir, "video-png"))
|
696 |
|
697 |
print("The last loss is: {}".format(loss.item()))
|
698 |
+
return img.detach().cpu().numpy(), svg_app_file_name
|
699 |
|
700 |
|
701 |
if __name__ == "__main__":
|