Spaces:
Runtime error
Runtime error
Badr AlKhamissi
commited on
Commit
•
6ee182d
1
Parent(s):
fee1f8d
changed visible params
Browse files
app.py
CHANGED
@@ -152,7 +152,7 @@ def init_shapes(svg_path, trainable: Mapping[str, bool]):
|
|
152 |
def run_main_ex(word, semantic_concept, num_steps):
|
153 |
prompt = f"a {semantic_concept}. minimal flat 2d vector. lineal color. trending on artstation"
|
154 |
font_name = "ArefRuqaa"
|
155 |
-
return list(next(run_main_app(semantic_concept, word, prompt, font_name, num_steps,
|
156 |
|
157 |
def run_main_app(semantic_concept, word, prompt, font_name, num_steps, example=0):
|
158 |
|
@@ -164,7 +164,7 @@ def run_main_app(semantic_concept, word, prompt, font_name, num_steps, example=0
|
|
164 |
preprocess(cfg.font, cfg.word, cfg.optimized_letter, cfg.level_of_cc)
|
165 |
filename_init = os.path.join("code/data/init/", f"{cfg.font}_{cfg.word}_scaled.svg").replace(" ", "_")
|
166 |
if not example:
|
167 |
-
yield gr.update(value=filename_init,visible=True),gr.update(visible=
|
168 |
|
169 |
sds_loss = SDSLoss(cfg, device, model)
|
170 |
|
@@ -249,7 +249,7 @@ def run_main_app(semantic_concept, word, prompt, font_name, num_steps, example=0
|
|
249 |
combine_word(cfg.word, cfg.optimized_letter, cfg.font, cfg.experiment_dir, device)
|
250 |
|
251 |
image = os.path.join(cfg.experiment_dir,f"{cfg.font}_{cfg.word}_{cfg.optimized_letter}.svg")
|
252 |
-
yield gr.update(value=filename_init,visible=True),gr.update(visible=
|
253 |
|
254 |
|
255 |
def change_prompt(concept, prompt_suffix):
|
@@ -313,7 +313,7 @@ with gr.Blocks() as demo:
|
|
313 |
|
314 |
with gr.Column():
|
315 |
result0 = gr.Image(type="filepath", label="Initial Word").style(height=333)
|
316 |
-
result1 = gr.Image(type="filepath", label="Optimization Process").style(height=
|
317 |
result2 = gr.Image(type="filepath", label="Final Result",visible=False).style(height=333)
|
318 |
|
319 |
|
|
|
152 |
def run_main_ex(word, semantic_concept, num_steps):
|
153 |
prompt = f"a {semantic_concept}. minimal flat 2d vector. lineal color. trending on artstation"
|
154 |
font_name = "ArefRuqaa"
|
155 |
+
return list(next(run_main_app(semantic_concept, word, prompt, font_name, num_steps, 0)))
|
156 |
|
157 |
def run_main_app(semantic_concept, word, prompt, font_name, num_steps, example=0):
|
158 |
|
|
|
164 |
preprocess(cfg.font, cfg.word, cfg.optimized_letter, cfg.level_of_cc)
|
165 |
filename_init = os.path.join("code/data/init/", f"{cfg.font}_{cfg.word}_scaled.svg").replace(" ", "_")
|
166 |
if not example:
|
167 |
+
yield gr.update(value=filename_init,visible=True),gr.update(visible=True, label=f'iters: 0 / {cfg.num_iter}'),gr.update(visible=False)
|
168 |
|
169 |
sds_loss = SDSLoss(cfg, device, model)
|
170 |
|
|
|
249 |
combine_word(cfg.word, cfg.optimized_letter, cfg.font, cfg.experiment_dir, device)
|
250 |
|
251 |
image = os.path.join(cfg.experiment_dir,f"{cfg.font}_{cfg.word}_{cfg.optimized_letter}.svg")
|
252 |
+
yield gr.update(value=filename_init,visible=True),gr.update(visible=True),gr.update(value=image,visible=True)
|
253 |
|
254 |
|
255 |
def change_prompt(concept, prompt_suffix):
|
|
|
313 |
|
314 |
with gr.Column():
|
315 |
result0 = gr.Image(type="filepath", label="Initial Word").style(height=333)
|
316 |
+
result1 = gr.Image(type="filepath", label="Optimization Process").style(height=333)
|
317 |
result2 = gr.Image(type="filepath", label="Final Result",visible=False).style(height=333)
|
318 |
|
319 |
|