Spaces:
Running
on
Zero
Running
on
Zero
add generate button instead of auto-triggering scale changes
Browse files
app.py
CHANGED
@@ -190,11 +190,12 @@ with gr.Blocks(css=css) as demo:
|
|
190 |
slider_x = gr.Dropdown(label="Slider X concept range", allow_custom_value=True, multiselect=True, max_choices=2)
|
191 |
slider_y = gr.Dropdown(label="Slider X concept range", allow_custom_value=True, multiselect=True, max_choices=2)
|
192 |
prompt = gr.Textbox(label="Prompt")
|
193 |
-
submit = gr.Button("
|
194 |
with gr.Group(elem_id="group"):
|
195 |
x = gr.Slider(minimum=-7, value=0, maximum=7, elem_id="x", interactive=False)
|
196 |
y = gr.Slider(minimum=-7, value=0, maximum=7, elem_id="y", interactive=False)
|
197 |
output_image = gr.Image(elem_id="image_out")
|
|
|
198 |
|
199 |
with gr.Accordion(label="advanced options", open=False):
|
200 |
iterations = gr.Slider(label = "num iterations", minimum=0, value=200, maximum=400)
|
@@ -222,6 +223,7 @@ with gr.Blocks(css=css) as demo:
|
|
222 |
x_a = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="x", interactive=False)
|
223 |
y_a = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="y", interactive=False)
|
224 |
output_image_a = gr.Image(elem_id="image_out")
|
|
|
225 |
|
226 |
with gr.Accordion(label="advanced options", open=False):
|
227 |
iterations_a = gr.Slider(label = "num iterations", minimum=0, value=200, maximum=300)
|
@@ -252,13 +254,16 @@ with gr.Blocks(css=css) as demo:
|
|
252 |
submit.click(fn=generate,
|
253 |
inputs=[slider_x, slider_y, prompt, seed, iterations, steps, guidance_scale, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2],
|
254 |
outputs=[x, y, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, output_image])
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
257 |
submit_a.click(fn=generate,
|
258 |
inputs=[slider_x_a, slider_y_a, prompt_a, seed_a, iterations_a, steps_a, guidance_scale_a, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale],
|
259 |
outputs=[x_a, y_a, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, output_image_a])
|
260 |
-
x_a.change(fn=update_scales, inputs=[x_a,y_a, prompt_a, seed_a, steps_a, guidance_scale_a, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale], outputs=[output_image_a])
|
261 |
-
y_a.change(fn=update_scales, inputs=[x_a,y_a, prompt, seed_a, steps_a, guidance_scale_a, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale], outputs=[output_image_a])
|
262 |
|
263 |
|
264 |
if __name__ == "__main__":
|
|
|
190 |
slider_x = gr.Dropdown(label="Slider X concept range", allow_custom_value=True, multiselect=True, max_choices=2)
|
191 |
slider_y = gr.Dropdown(label="Slider X concept range", allow_custom_value=True, multiselect=True, max_choices=2)
|
192 |
prompt = gr.Textbox(label="Prompt")
|
193 |
+
submit = gr.Button("find directions")
|
194 |
with gr.Group(elem_id="group"):
|
195 |
x = gr.Slider(minimum=-7, value=0, maximum=7, elem_id="x", interactive=False)
|
196 |
y = gr.Slider(minimum=-7, value=0, maximum=7, elem_id="y", interactive=False)
|
197 |
output_image = gr.Image(elem_id="image_out")
|
198 |
+
generate = gr.Button("generate")
|
199 |
|
200 |
with gr.Accordion(label="advanced options", open=False):
|
201 |
iterations = gr.Slider(label = "num iterations", minimum=0, value=200, maximum=400)
|
|
|
223 |
x_a = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="x", interactive=False)
|
224 |
y_a = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="y", interactive=False)
|
225 |
output_image_a = gr.Image(elem_id="image_out")
|
226 |
+
generate_a = gr.Button("generate")
|
227 |
|
228 |
with gr.Accordion(label="advanced options", open=False):
|
229 |
iterations_a = gr.Slider(label = "num iterations", minimum=0, value=200, maximum=300)
|
|
|
254 |
submit.click(fn=generate,
|
255 |
inputs=[slider_x, slider_y, prompt, seed, iterations, steps, guidance_scale, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2],
|
256 |
outputs=[x, y, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, output_image])
|
257 |
+
|
258 |
+
generate.click(fn=update_scales, inputs=[x,y, prompt, seed, steps, guidance_scale, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2], outputs=[output_image])
|
259 |
+
generate_a.click(fn=update_scales, inputs=[x_a,y_a, prompt_a, seed_a, steps_a, guidance_scale_a, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale], outputs=[output_image_a])
|
260 |
+
#x.change(fn=update_scales, inputs=[x,y, prompt, seed, steps, guidance_scale, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2], outputs=[output_image])
|
261 |
+
#y.change(fn=update_scales, inputs=[x,y, prompt, seed, steps, guidance_scale, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2], outputs=[output_image])
|
262 |
submit_a.click(fn=generate,
|
263 |
inputs=[slider_x_a, slider_y_a, prompt_a, seed_a, iterations_a, steps_a, guidance_scale_a, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale],
|
264 |
outputs=[x_a, y_a, x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, output_image_a])
|
265 |
+
#x_a.change(fn=update_scales, inputs=[x_a,y_a, prompt_a, seed_a, steps_a, guidance_scale_a, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale], outputs=[output_image_a])
|
266 |
+
#y_a.change(fn=update_scales, inputs=[x_a,y_a, prompt, seed_a, steps_a, guidance_scale_a, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, img2img_type, image, controlnet_conditioning_scale, ip_adapter_scale], outputs=[output_image_a])
|
267 |
|
268 |
|
269 |
if __name__ == "__main__":
|