Spaces:
Runtime error
Runtime error
update interface
Browse files
app.py
CHANGED
|
@@ -113,6 +113,8 @@ def load_ckpt(model_ckpt = "LAION-Glyph-10M-Epoch-5"):
|
|
| 113 |
def export_parameters(*args):
|
| 114 |
return str(args)
|
| 115 |
|
|
|
|
|
|
|
| 116 |
|
| 117 |
SAVE_MEMORY = True #False
|
| 118 |
disable_verbosity()
|
|
@@ -126,7 +128,8 @@ description = """
|
|
| 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')
|
|
@@ -143,8 +146,7 @@ with block:
|
|
| 143 |
default_width = [0.3, 0.3, 0.3, 0.3]
|
| 144 |
default_top_left_x = [0.35, 0.15, 0.15, 0.5]
|
| 145 |
default_top_left_y = [0.4, 0.15, 0.65, 0.65]
|
| 146 |
-
with gr.Column():
|
| 147 |
-
|
| 148 |
with gr.Row():
|
| 149 |
for i in range(4):
|
| 150 |
with gr.Column():
|
|
@@ -192,10 +194,15 @@ with block:
|
|
| 192 |
shared_a_prompt = gr.Textbox(label="Added Prompt", value='4K, dslr, best quality, extremely detailed')
|
| 193 |
shared_n_prompt = gr.Textbox(label="Negative Prompt",
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
with gr.Row():
|
| 200 |
message = gr.Text(interactive=False, label = "Message")
|
| 201 |
with gr.Row():
|
|
@@ -228,7 +235,20 @@ with block:
|
|
| 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 = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
run_button.click(fn=process_multi_wrapper,
|
| 234 |
inputs=[rendered_txt_0, rendered_txt_1, rendered_txt_2, rendered_txt_3,
|
|
|
|
| 113 |
def export_parameters(*args):
|
| 114 |
return str(args)
|
| 115 |
|
| 116 |
+
def import_parameters(parameters):
|
| 117 |
+
return eval(parameters)
|
| 118 |
|
| 119 |
SAVE_MEMORY = True #False
|
| 120 |
disable_verbosity()
|
|
|
|
| 128 |
## Control Stable Diffusion with Glyph Images
|
| 129 |
Github link: [Link](https://github.com/AIGText/GlyphControl-release).
|
| 130 |
Report: [link](https://arxiv.org/pdf/2305.18259.pdf).\n
|
| 131 |
+
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.\n
|
| 132 |
+
(By using the "Parameter Summary" part, you can import or export the parameter settings of generated iamges in an easier way.)
|
| 133 |
"""
|
| 134 |
|
| 135 |
SPACE_ID = os.getenv('SPACE_ID')
|
|
|
|
| 146 |
default_width = [0.3, 0.3, 0.3, 0.3]
|
| 147 |
default_top_left_x = [0.35, 0.15, 0.15, 0.5]
|
| 148 |
default_top_left_y = [0.4, 0.15, 0.65, 0.65]
|
| 149 |
+
with gr.Column():
|
|
|
|
| 150 |
with gr.Row():
|
| 151 |
for i in range(4):
|
| 152 |
with gr.Column():
|
|
|
|
| 194 |
shared_a_prompt = gr.Textbox(label="Added Prompt", value='4K, dslr, best quality, extremely detailed')
|
| 195 |
shared_n_prompt = gr.Textbox(label="Negative Prompt",
|
| 196 |
value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
|
| 197 |
+
with gr.Accordion("Parameter Summary", open=False):
|
|
|
|
| 198 |
with gr.Row():
|
| 199 |
+
parameters = gr.Text(label = "Parameters")
|
| 200 |
+
with gr.Row():
|
| 201 |
+
import_button = gr.Button(value="Import")
|
| 202 |
+
export_button = gr.Button(value="Export")
|
| 203 |
+
with gr.Accordion("Output", open=True):
|
| 204 |
+
# with gr.Row():
|
| 205 |
+
# export_button = gr.Button(value="Export Parameters")
|
| 206 |
with gr.Row():
|
| 207 |
message = gr.Text(interactive=False, label = "Message")
|
| 208 |
with gr.Row():
|
|
|
|
| 235 |
shared_ddim_steps, shared_guess_mode,
|
| 236 |
shared_strength, shared_scale, shared_seed,
|
| 237 |
shared_eta, shared_a_prompt, shared_n_prompt],
|
| 238 |
+
outputs = [parameters] )
|
| 239 |
+
|
| 240 |
+
import_button.click(fn=import_parameters,
|
| 241 |
+
inputs = [parameters],
|
| 242 |
+
outputs = [model_ckpt, shared_prompt,
|
| 243 |
+
rendered_txt_0, width_0, ratio_0, top_left_x_0, top_left_y_0, yaw_0, num_rows_0,
|
| 244 |
+
rendered_txt_1, width_1, ratio_1, top_left_x_1, top_left_y_1, yaw_1, num_rows_1,
|
| 245 |
+
rendered_txt_2, width_2, ratio_2, top_left_x_2, top_left_y_2, yaw_2, num_rows_2,
|
| 246 |
+
rendered_txt_3, width_3, ratio_3, top_left_x_3, top_left_y_3, yaw_3, num_rows_3,
|
| 247 |
+
shared_num_samples, shared_image_resolution,
|
| 248 |
+
shared_ddim_steps, shared_guess_mode,
|
| 249 |
+
shared_strength, shared_scale, shared_seed,
|
| 250 |
+
shared_eta, shared_a_prompt, shared_n_prompt]
|
| 251 |
+
)
|
| 252 |
|
| 253 |
run_button.click(fn=process_multi_wrapper,
|
| 254 |
inputs=[rendered_txt_0, rendered_txt_1, rendered_txt_2, rendered_txt_3,
|