Update app.py
Browse files
app.py
CHANGED
@@ -121,8 +121,9 @@ def plex(mput, prompt, neg_prompt, stips, modal_id, dula, blip, blop):
|
|
121 |
pope.unet.to(memory_format=torch.channels_last)
|
122 |
pope = accelerator.prepare(pope.to("cpu"))
|
123 |
pipe = accelerator.prepare(StableDiffusionControlNetPipeline.from_pretrained(modal_id, use_safetensors=False,controlnet=controlnet, safety_checker=None,torch_dtype=torch.float32))
|
124 |
-
pipe
|
125 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
|
|
126 |
|
127 |
tilage = pope(prompt,num_inference_steps=5,height=512,width=512,generator=generator).images[0]
|
128 |
cannyimage = np.array(tilage)
|
@@ -139,7 +140,7 @@ def plex(mput, prompt, neg_prompt, stips, modal_id, dula, blip, blop):
|
|
139 |
openpose_image = openpose(pose_image)
|
140 |
images = [openpose_image, canny_image]
|
141 |
|
142 |
-
imoge = pipe(prompt,images,num_inference_steps=stips,negative_prompt=neg_prompt,controlnet_conditioning_scale=[blip, blop],generator=generator).images[0]
|
143 |
return imoge
|
144 |
|
145 |
iface = gr.Interface(fn=plex,inputs=[gr.Image(type="filepath"), gr.Textbox(label="prompt"), gr.Textbox(label="neg_prompt", value="monochrome, lowres, bad anatomy, worst quality, low quality"), gr.Slider(label="infer_steps", value=20, minimum=1, step=1, maximum=100), gr.Dropdown(choices=models, value=models[0], type="value", label="select a model"), gr.Dropdown(choices=sdulers, value=sdulers[0], type="value", label="schedulrs"), gr.Slider(label="condition_scale_canny", value=0.5, minimum=0.05, step=0.05, maximum=0.95), gr.Slider(label="condition_scale_pose", value=0.5, minimum=0.05, step=0.05, maximum=0.95)], outputs=gr.Image(), title="Img2Img Guided Multi-Conditioned Canny/Pose Controlnet Selectable StableDiffusion Model Demo", description="by JoPmt.")
|
|
|
121 |
pope.unet.to(memory_format=torch.channels_last)
|
122 |
pope = accelerator.prepare(pope.to("cpu"))
|
123 |
pipe = accelerator.prepare(StableDiffusionControlNetPipeline.from_pretrained(modal_id, use_safetensors=False,controlnet=controlnet, safety_checker=None,torch_dtype=torch.float32))
|
124 |
+
pipe.unet.to(memory_format=torch.channels_last)
|
125 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
126 |
+
pipe = accelerator.prepare(pipe.to("cpu"))
|
127 |
|
128 |
tilage = pope(prompt,num_inference_steps=5,height=512,width=512,generator=generator).images[0]
|
129 |
cannyimage = np.array(tilage)
|
|
|
140 |
openpose_image = openpose(pose_image)
|
141 |
images = [openpose_image, canny_image]
|
142 |
|
143 |
+
imoge = pipe(prompt,images,num_inference_steps=stips,negative_prompt=neg_prompt,controlnet_conditioning_scale=[blip, blop],height=512,width=512,generator=generator).images[0]
|
144 |
return imoge
|
145 |
|
146 |
iface = gr.Interface(fn=plex,inputs=[gr.Image(type="filepath"), gr.Textbox(label="prompt"), gr.Textbox(label="neg_prompt", value="monochrome, lowres, bad anatomy, worst quality, low quality"), gr.Slider(label="infer_steps", value=20, minimum=1, step=1, maximum=100), gr.Dropdown(choices=models, value=models[0], type="value", label="select a model"), gr.Dropdown(choices=sdulers, value=sdulers[0], type="value", label="schedulrs"), gr.Slider(label="condition_scale_canny", value=0.5, minimum=0.05, step=0.05, maximum=0.95), gr.Slider(label="condition_scale_pose", value=0.5, minimum=0.05, step=0.05, maximum=0.95)], outputs=gr.Image(), title="Img2Img Guided Multi-Conditioned Canny/Pose Controlnet Selectable StableDiffusion Model Demo", description="by JoPmt.")
|