Spaces:
Runtime error
Runtime error
Xu Ma
commited on
Commit
•
3d75b86
1
Parent(s):
df6c793
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
os.system('python setup.py install --user')
|
3 |
import argparse
|
4 |
import csv
|
|
|
5 |
import sys
|
6 |
sys.path.append("/home/user/.local/lib/python3.8/site-packages/diffvg-0.0.1-py3.8-linux-x86_64.egg")
|
7 |
print(sys.path)
|
@@ -24,6 +25,7 @@ from tqdm import tqdm
|
|
24 |
import yaml
|
25 |
from easydict import EasyDict as edict
|
26 |
|
|
|
27 |
def run_cmd(command):
|
28 |
try:
|
29 |
print(command)
|
@@ -31,7 +33,6 @@ def run_cmd(command):
|
|
31 |
except KeyboardInterrupt:
|
32 |
print("Process interrupted")
|
33 |
sys.exit(1)
|
34 |
-
|
35 |
# run_cmd("gcc --version")
|
36 |
# run_cmd("pwd")
|
37 |
# run_cmd("ls")
|
@@ -49,6 +50,7 @@ def run_cmd(command):
|
|
49 |
# run_cmd("python main.py --config config/base.yaml --experiment experiment_5x1 --signature smile --target figures/smile.png --log_dir log/")
|
50 |
from main import main_func
|
51 |
|
|
|
52 |
def parse_args():
|
53 |
parser = argparse.ArgumentParser()
|
54 |
parser.add_argument('--debug', action='store_true', default=False)
|
@@ -92,7 +94,6 @@ def parse_args():
|
|
92 |
return cfg
|
93 |
|
94 |
|
95 |
-
|
96 |
def app_experiment_change(experiment_id):
|
97 |
if experiment_id == "add [1, 1, 1, 1, 1] total 5 paths":
|
98 |
return "experiment_5x1"
|
@@ -103,13 +104,16 @@ def app_experiment_change(experiment_id):
|
|
103 |
elif experiment_id == "add [1,2,4,8,16,32, ...] total 256 paths":
|
104 |
return "experiment_exp2_256"
|
105 |
|
|
|
106 |
cfg_arg = parse_args()
|
|
|
|
|
107 |
def run_live(img, experiment_id, cfg_arg=cfg_arg):
|
108 |
experiment = app_experiment_change(experiment_id)
|
109 |
cfg_arg.target = img
|
110 |
cfg_arg.experiment = experiment
|
111 |
img, text = main_func(img, experiment_id, cfg_arg=cfg_arg)
|
112 |
-
return
|
113 |
|
114 |
|
115 |
|
|
|
2 |
os.system('python setup.py install --user')
|
3 |
import argparse
|
4 |
import csv
|
5 |
+
import numpy as np
|
6 |
import sys
|
7 |
sys.path.append("/home/user/.local/lib/python3.8/site-packages/diffvg-0.0.1-py3.8-linux-x86_64.egg")
|
8 |
print(sys.path)
|
|
|
25 |
import yaml
|
26 |
from easydict import EasyDict as edict
|
27 |
|
28 |
+
|
29 |
def run_cmd(command):
|
30 |
try:
|
31 |
print(command)
|
|
|
33 |
except KeyboardInterrupt:
|
34 |
print("Process interrupted")
|
35 |
sys.exit(1)
|
|
|
36 |
# run_cmd("gcc --version")
|
37 |
# run_cmd("pwd")
|
38 |
# run_cmd("ls")
|
|
|
50 |
# run_cmd("python main.py --config config/base.yaml --experiment experiment_5x1 --signature smile --target figures/smile.png --log_dir log/")
|
51 |
from main import main_func
|
52 |
|
53 |
+
|
54 |
def parse_args():
|
55 |
parser = argparse.ArgumentParser()
|
56 |
parser.add_argument('--debug', action='store_true', default=False)
|
|
|
94 |
return cfg
|
95 |
|
96 |
|
|
|
97 |
def app_experiment_change(experiment_id):
|
98 |
if experiment_id == "add [1, 1, 1, 1, 1] total 5 paths":
|
99 |
return "experiment_5x1"
|
|
|
104 |
elif experiment_id == "add [1,2,4,8,16,32, ...] total 256 paths":
|
105 |
return "experiment_exp2_256"
|
106 |
|
107 |
+
|
108 |
cfg_arg = parse_args()
|
109 |
+
temp_image = np.random([224,224,3])
|
110 |
+
temp_text = "start"
|
111 |
def run_live(img, experiment_id, cfg_arg=cfg_arg):
|
112 |
experiment = app_experiment_change(experiment_id)
|
113 |
cfg_arg.target = img
|
114 |
cfg_arg.experiment = experiment
|
115 |
img, text = main_func(img, experiment_id, cfg_arg=cfg_arg)
|
116 |
+
return temp_image, temp_text
|
117 |
|
118 |
|
119 |
|