Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,28 +67,6 @@ def generate(
|
|
| 67 |
mask_url = '',
|
| 68 |
):
|
| 69 |
if torch.cuda.is_available():
|
| 70 |
-
|
| 71 |
-
if not use_img2img:
|
| 72 |
-
pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
| 73 |
-
|
| 74 |
-
if use_vae:
|
| 75 |
-
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
| 76 |
-
pipe = DiffusionPipeline.from_pretrained(model, vae=vae, torch_dtype=torch.float16)
|
| 77 |
-
|
| 78 |
-
if use_img2img:
|
| 79 |
-
pipe = AutoPipelineForImage2Image.from_pretrained(model, torch_dtype=torch.float16)
|
| 80 |
-
|
| 81 |
-
if use_vae:
|
| 82 |
-
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
| 83 |
-
pipe = AutoPipelineForImage2Image.from_pretrained(model, vae=vae, torch_dtype=torch.float16)
|
| 84 |
-
|
| 85 |
-
if use_inpainting:
|
| 86 |
-
pipe = AutoPipelineForInpainting.from_pretrained(model, torch_dtype=torch.float16)
|
| 87 |
-
|
| 88 |
-
image_init = load_image(img_url)
|
| 89 |
-
mask_image = load_image(mask_url)
|
| 90 |
-
|
| 91 |
-
if use_controlnet:
|
| 92 |
controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
|
| 93 |
pipe = StableDiffusionControlNetPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16)
|
| 94 |
|
|
@@ -131,6 +109,7 @@ def generate(
|
|
| 131 |
image=image,
|
| 132 |
control_image=canny_image,
|
| 133 |
).images[0]
|
|
|
|
| 134 |
|
| 135 |
with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
|
| 136 |
gr.HTML(
|
|
|
|
| 67 |
mask_url = '',
|
| 68 |
):
|
| 69 |
if torch.cuda.is_available():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
|
| 71 |
pipe = StableDiffusionControlNetPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16)
|
| 72 |
|
|
|
|
| 109 |
image=image,
|
| 110 |
control_image=canny_image,
|
| 111 |
).images[0]
|
| 112 |
+
return image
|
| 113 |
|
| 114 |
with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
|
| 115 |
gr.HTML(
|