Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -448,7 +448,51 @@ class ControlNetDepthDesignModelMulti:
|
|
448 |
|
449 |
return design_image
|
450 |
|
451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
def on_submit(image, text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt, img_size):
|
453 |
model.seed = seed
|
454 |
model.neg_prompt = n_prompt
|
@@ -460,10 +504,7 @@ class ControlNetDepthDesignModelMulti:
|
|
460 |
return out_img
|
461 |
|
462 |
submit.click(on_submit, inputs=[input_image, input_text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt, img_size], outputs=design_image)
|
463 |
-
|
464 |
-
inputs=[input_image, input_text], cache_examples=False)
|
465 |
-
|
466 |
-
|
467 |
|
468 |
controlnet_depth= ControlNetModel.from_pretrained(
|
469 |
"controlnet_depth", torch_dtype=dtype, use_safetensors=True)
|
|
|
448 |
|
449 |
return design_image
|
450 |
|
451 |
+
def create_demo(model):
|
452 |
+
gr.Markdown("### Just try zeroGPU")
|
453 |
+
with gr.Row():
|
454 |
+
with gr.Column():
|
455 |
+
input_image = gr.Image(label="Input Image", type='pil', elem_id='img-display-input')
|
456 |
+
input_text = gr.Textbox(label='Prompt', placeholder='Please upload your image first', lines=2)
|
457 |
+
with gr.Accordion('Advanced options', open=False):
|
458 |
+
num_steps = gr.Slider(label='Steps',
|
459 |
+
minimum=1,
|
460 |
+
maximum=50,
|
461 |
+
value=50,
|
462 |
+
step=1)
|
463 |
+
img_size = gr.Slider(label='Image size',
|
464 |
+
minimum=256,
|
465 |
+
maximum=768,
|
466 |
+
value=768,
|
467 |
+
step=64)
|
468 |
+
guidance_scale = gr.Slider(label='Guidance Scale',
|
469 |
+
minimum=0.1,
|
470 |
+
maximum=30.0,
|
471 |
+
value=10.0,
|
472 |
+
step=0.1)
|
473 |
+
seed = gr.Slider(label='Seed',
|
474 |
+
minimum=-1,
|
475 |
+
maximum=2147483647,
|
476 |
+
value=323*111,
|
477 |
+
step=1,
|
478 |
+
randomize=True)
|
479 |
+
strength = gr.Slider(label='Strength',
|
480 |
+
minimum=0.1,
|
481 |
+
maximum=1.0,
|
482 |
+
value=0.9,
|
483 |
+
step=0.1)
|
484 |
+
a_prompt = gr.Textbox(
|
485 |
+
label='Added Prompt',
|
486 |
+
value="interior design, 4K, high resolution, photorealistic")
|
487 |
+
n_prompt = gr.Textbox(
|
488 |
+
label='Negative Prompt',
|
489 |
+
value="window, door, low resolution, banner, logo, watermark, text, deformed, blurry, out of focus, surreal, ugly, beginner")
|
490 |
+
submit = gr.Button("Submit")
|
491 |
+
|
492 |
+
with gr.Column():
|
493 |
+
design_image = gr.Image(label="Output Mask", elem_id='img-display-output')
|
494 |
+
|
495 |
+
|
496 |
def on_submit(image, text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt, img_size):
|
497 |
model.seed = seed
|
498 |
model.neg_prompt = n_prompt
|
|
|
504 |
return out_img
|
505 |
|
506 |
submit.click(on_submit, inputs=[input_image, input_text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt, img_size], outputs=design_image)
|
507 |
+
|
|
|
|
|
|
|
508 |
|
509 |
controlnet_depth= ControlNetModel.from_pretrained(
|
510 |
"controlnet_depth", torch_dtype=dtype, use_safetensors=True)
|