Spaces:
Runtime error
Runtime error
update interface and examples.
Browse files- app.py +19 -3
- example_list.py +2 -2
app.py
CHANGED
|
@@ -110,6 +110,10 @@ def load_ckpt(model_ckpt = "LAION-Glyph-10M-Epoch-5"):
|
|
| 110 |
allow_run_generation = False
|
| 111 |
return output_str, None, allow_run_generation
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
SAVE_MEMORY = True #False
|
| 114 |
disable_verbosity()
|
| 115 |
if SAVE_MEMORY:
|
|
@@ -122,7 +126,7 @@ description = """
|
|
| 122 |
## Control Stable Diffusion with Glyph Images
|
| 123 |
Github link: [Link](https://github.com/AIGText/GlyphControl-release).
|
| 124 |
Report: [link](https://arxiv.org/pdf/2305.18259.pdf).\n
|
| 125 |
-
You could try the listed examples at the bottom by clicking on them. We will update the examples progressively.
|
| 126 |
"""
|
| 127 |
|
| 128 |
SPACE_ID = os.getenv('SPACE_ID')
|
|
@@ -190,11 +194,12 @@ with block:
|
|
| 190 |
value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
|
| 191 |
|
| 192 |
with gr.Accordion("Output", open=True):
|
|
|
|
|
|
|
| 193 |
with gr.Row():
|
| 194 |
message = gr.Text(interactive=False, label = "Message")
|
| 195 |
with gr.Row():
|
| 196 |
-
result_gallery = gr.Gallery(label='Images', show_label=False, elem_id="gallery").style(grid=2, height='auto')
|
| 197 |
-
# export_button = gr.Button(value="Export Parameters")
|
| 198 |
gr.Examples(
|
| 199 |
examples= examples, #"./examples",
|
| 200 |
# [[, "LAION-Glyph-10M-Epoch-6"]],
|
|
@@ -213,6 +218,17 @@ with block:
|
|
| 213 |
# outputs=output_img,
|
| 214 |
# fn=inference
|
| 215 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
run_button.click(fn=process_multi_wrapper,
|
| 218 |
inputs=[rendered_txt_0, rendered_txt_1, rendered_txt_2, rendered_txt_3,
|
|
|
|
| 110 |
allow_run_generation = False
|
| 111 |
return output_str, None, allow_run_generation
|
| 112 |
|
| 113 |
+
def export_parameters(*args):
|
| 114 |
+
return str(args)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
SAVE_MEMORY = True #False
|
| 118 |
disable_verbosity()
|
| 119 |
if SAVE_MEMORY:
|
|
|
|
| 126 |
## Control Stable Diffusion with Glyph Images
|
| 127 |
Github link: [Link](https://github.com/AIGText/GlyphControl-release).
|
| 128 |
Report: [link](https://arxiv.org/pdf/2305.18259.pdf).\n
|
| 129 |
+
You could try the listed examples at the bottom by clicking on them and modify the parameters for your own creation. We will update the examples progressively.
|
| 130 |
"""
|
| 131 |
|
| 132 |
SPACE_ID = os.getenv('SPACE_ID')
|
|
|
|
| 194 |
value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
|
| 195 |
|
| 196 |
with gr.Accordion("Output", open=True):
|
| 197 |
+
with gr.Row():
|
| 198 |
+
export_button = gr.Button(value="Export Parameters")
|
| 199 |
with gr.Row():
|
| 200 |
message = gr.Text(interactive=False, label = "Message")
|
| 201 |
with gr.Row():
|
| 202 |
+
result_gallery = gr.Gallery(label='Images', show_label=False, elem_id="gallery").style(grid=2, height='auto')
|
|
|
|
| 203 |
gr.Examples(
|
| 204 |
examples= examples, #"./examples",
|
| 205 |
# [[, "LAION-Glyph-10M-Epoch-6"]],
|
|
|
|
| 218 |
# outputs=output_img,
|
| 219 |
# fn=inference
|
| 220 |
)
|
| 221 |
+
export_button.click(fn=export_parameters,
|
| 222 |
+
inputs = [model_ckpt, shared_prompt,
|
| 223 |
+
rendered_txt_0, width_0, ratio_0, top_left_x_0, top_left_y_0, yaw_0, num_rows_0,
|
| 224 |
+
rendered_txt_1, width_1, ratio_1, top_left_x_1, top_left_y_1, yaw_1, num_rows_1,
|
| 225 |
+
rendered_txt_2, width_2, ratio_2, top_left_x_2, top_left_y_2, yaw_2, num_rows_2,
|
| 226 |
+
rendered_txt_3, width_3, ratio_3, top_left_x_3, top_left_y_3, yaw_3, num_rows_3,
|
| 227 |
+
shared_num_samples, shared_image_resolution,
|
| 228 |
+
shared_ddim_steps, shared_guess_mode,
|
| 229 |
+
shared_strength, shared_scale, shared_seed,
|
| 230 |
+
shared_eta, shared_a_prompt, shared_n_prompt],
|
| 231 |
+
outputs = [message] )
|
| 232 |
|
| 233 |
run_button.click(fn=process_multi_wrapper,
|
| 234 |
inputs=[rendered_txt_0, rendered_txt_1, rendered_txt_2, rendered_txt_3,
|
example_list.py
CHANGED
|
@@ -18,8 +18,8 @@ example_2 = [
|
|
| 18 |
'Monster Attacks Mars', 0.8, 0, 0.1, 0.45, 0, 1,
|
| 19 |
"", 0.3, 0, 0.15, 0.65, 0, 1,
|
| 20 |
"", 0.3, 0, 0.5, 0.65, 0, 1,
|
| 21 |
-
5,512,20,False,1,9,430637146,
|
| 22 |
-
0, "4K, dslr, best quality, extremely detailed",
|
| 23 |
"longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality"
|
| 24 |
]
|
| 25 |
examples = [example_1, example_2]
|
|
|
|
| 18 |
'Monster Attacks Mars', 0.8, 0, 0.1, 0.45, 0, 1,
|
| 19 |
"", 0.3, 0, 0.15, 0.65, 0, 1,
|
| 20 |
"", 0.3, 0, 0.5, 0.65, 0, 1,
|
| 21 |
+
5,512,20,False,1,9,430637146,
|
| 22 |
+
0, "best quality, extremely detailed", #"4K, dslr, best quality, extremely detailed",
|
| 23 |
"longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality"
|
| 24 |
]
|
| 25 |
examples = [example_1, example_2]
|