Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -237,15 +237,15 @@ def run_main_app(semantic_concept, word, letter, font_name, num_steps, example=0
|
|
| 237 |
combine_word(cfg.word, cfg.optimized_letter, cfg.font, cfg.experiment_dir)
|
| 238 |
|
| 239 |
image = os.path.join(cfg.experiment_dir,f"{cfg.font}_{cfg.word}_{cfg.optimized_letter}.svg")
|
| 240 |
-
yield gr.update(value=
|
| 241 |
|
| 242 |
-
|
| 243 |
-
|
| 244 |
|
| 245 |
-
|
| 246 |
-
|
| 247 |
|
| 248 |
-
|
| 249 |
|
| 250 |
|
| 251 |
with gr.Blocks() as demo:
|
|
@@ -297,9 +297,9 @@ with gr.Blocks() as demo:
|
|
| 297 |
run = gr.Button('Generate')
|
| 298 |
|
| 299 |
with gr.Column():
|
| 300 |
-
result0 = gr.
|
| 301 |
-
result1 = gr.
|
| 302 |
-
result2 = gr.
|
| 303 |
|
| 304 |
|
| 305 |
with gr.Row():
|
|
|
|
| 237 |
combine_word(cfg.word, cfg.optimized_letter, cfg.font, cfg.experiment_dir)
|
| 238 |
|
| 239 |
image = os.path.join(cfg.experiment_dir,f"{cfg.font}_{cfg.word}_{cfg.optimized_letter}.svg")
|
| 240 |
+
yield gr.update(value=filename_init,visible=True),gr.update(visible=False),gr.update(value=image,visible=True)
|
| 241 |
|
| 242 |
+
with open(filename_init, "r") as f0:
|
| 243 |
+
svg_content_init = f0.read()
|
| 244 |
|
| 245 |
+
with open(image, "r") as f1:
|
| 246 |
+
svg_content_final = f1.read()
|
| 247 |
|
| 248 |
+
yield gr.update(value=f'<div style="width: 333px; height: 333px;">{svg_content_init}</div>',label="Initial Word",visible=True),gr.update(visible=False),gr.update(value=f"<div>{svg_content_final}</div>",label="Final Result",visible=True)
|
| 249 |
|
| 250 |
|
| 251 |
with gr.Blocks() as demo:
|
|
|
|
| 297 |
run = gr.Button('Generate')
|
| 298 |
|
| 299 |
with gr.Column():
|
| 300 |
+
result0 = gr.HTML() #gr.Image(type="filepath", label="Initial Word",height=333)
|
| 301 |
+
result1 = gr.Image(type="filepath", label="Optimization Process",height=100)
|
| 302 |
+
result2 = gr.HTML(label="Final Result") #gr.Image(type="filepath", label="Final Result",visible=False,height=333)
|
| 303 |
|
| 304 |
|
| 305 |
with gr.Row():
|