Spaces:
Runtime error
Runtime error
Badr AlKhamissi
commited on
Commit
·
cbe8e78
1
Parent(s):
b374c34
bug fix
Browse files
app.py
CHANGED
@@ -66,7 +66,7 @@ pydiffvg.set_print_timing(False)
|
|
66 |
gamma = 1.0
|
67 |
|
68 |
|
69 |
-
def set_config(semantic_concept, word, font_name, num_steps):
|
70 |
|
71 |
cfg_d = edict()
|
72 |
cfg_d.config = "code/config/base.yaml"
|
@@ -95,7 +95,7 @@ def set_config(semantic_concept, word, font_name, num_steps):
|
|
95 |
|
96 |
if ' ' in cfg.word:
|
97 |
raise gr.Error(f'should be only one word')
|
98 |
-
cfg.caption =
|
99 |
cfg.log_dir = f"output/{cfg.experiment}_{cfg.word}"
|
100 |
if cfg.optimized_letter in cfg.word:
|
101 |
cfg.optimized_letter = cfg.optimized_letter
|
@@ -142,12 +142,12 @@ def init_shapes(svg_path, trainable: Mapping[str, bool]):
|
|
142 |
return shapes_init, shape_groups_init, parameters
|
143 |
|
144 |
|
145 |
-
def run_main_ex(semantic_concept, word, font_name, num_steps):
|
146 |
-
return list(next(run_main_app(semantic_concept, word, font_name, num_steps, 1)))
|
147 |
|
148 |
-
def run_main_app(semantic_concept, word, font_name, num_steps, example=0):
|
149 |
|
150 |
-
cfg = set_config(semantic_concept, word, font_name, num_steps)
|
151 |
|
152 |
pydiffvg.set_use_gpu(torch.cuda.is_available())
|
153 |
|
@@ -362,6 +362,7 @@ with gr.Blocks() as demo:
|
|
362 |
inputs = [
|
363 |
semantic_concept,
|
364 |
word,
|
|
|
365 |
font_name,
|
366 |
num_steps
|
367 |
]
|
|
|
66 |
gamma = 1.0
|
67 |
|
68 |
|
69 |
+
def set_config(semantic_concept, word, prompt, font_name, num_steps):
|
70 |
|
71 |
cfg_d = edict()
|
72 |
cfg_d.config = "code/config/base.yaml"
|
|
|
95 |
|
96 |
if ' ' in cfg.word:
|
97 |
raise gr.Error(f'should be only one word')
|
98 |
+
cfg.caption = prompt
|
99 |
cfg.log_dir = f"output/{cfg.experiment}_{cfg.word}"
|
100 |
if cfg.optimized_letter in cfg.word:
|
101 |
cfg.optimized_letter = cfg.optimized_letter
|
|
|
142 |
return shapes_init, shape_groups_init, parameters
|
143 |
|
144 |
|
145 |
+
def run_main_ex(semantic_concept, word, prompt, font_name, num_steps):
|
146 |
+
return list(next(run_main_app(semantic_concept, word, prompt, font_name, num_steps, 1)))
|
147 |
|
148 |
+
def run_main_app(semantic_concept, word, prompt, font_name, num_steps, example=0):
|
149 |
|
150 |
+
cfg = set_config(semantic_concept, word, prompt, font_name, num_steps)
|
151 |
|
152 |
pydiffvg.set_use_gpu(torch.cuda.is_available())
|
153 |
|
|
|
362 |
inputs = [
|
363 |
semantic_concept,
|
364 |
word,
|
365 |
+
prompt,
|
366 |
font_name,
|
367 |
num_steps
|
368 |
]
|