Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -146,6 +146,17 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
|
|
146 |
variant="fp16"
|
147 |
)
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
150 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
151 |
controlnet=controlnet,
|
@@ -329,7 +340,7 @@ with gr.Blocks(css=css) as demo:
|
|
329 |
|
330 |
with gr.Column():
|
331 |
with gr.Group():
|
332 |
-
preprocessor = gr.Dropdown(label="Preprocessor", choices=["canny", "lineart"], value="canny", interactive=True, info="For the moment, only canny is available")
|
333 |
controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=1.0, step=0.01, value=0.5)
|
334 |
with gr.Group():
|
335 |
seed = gr.Slider(
|
|
|
146 |
variant="fp16"
|
147 |
)
|
148 |
|
149 |
+
if preprocessor == "custom":
|
150 |
+
image = Image.open(image_in)
|
151 |
+
image = image.convert("RGB")
|
152 |
+
image = np.array(image)
|
153 |
+
image = Image.fromarray(image)
|
154 |
+
|
155 |
+
controlnet = ControlNetModel.from_pretrained(
|
156 |
+
"fffiloni/cn_malgras_second_002",
|
157 |
+
torch_dtype=torch.float16,
|
158 |
+
)
|
159 |
+
|
160 |
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
161 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
162 |
controlnet=controlnet,
|
|
|
340 |
|
341 |
with gr.Column():
|
342 |
with gr.Group():
|
343 |
+
preprocessor = gr.Dropdown(label="Preprocessor", choices=["canny", "lineart", "custom"], value="canny", interactive=True, info="For the moment, only canny is available")
|
344 |
controlnet_conditioning_scale = gr.Slider(label="Controlnet conditioning Scale", minimum=0.1, maximum=1.0, step=0.01, value=0.5)
|
345 |
with gr.Group():
|
346 |
seed = gr.Slider(
|