Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def infer(
|
|
45 |
|
46 |
pipe = None
|
47 |
if (model_id=="stable-diffusion-v1-5/stable-diffusion-v1-5 with lora"):
|
48 |
-
pipe=DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype
|
49 |
pipe.unet = PeftModel.from_pretrained(pipe.unet,"um235/cartoon_cat_stickers")
|
50 |
else:
|
51 |
print("stable-diffusion-v1-5/stable-diffusion-v1-5 with lora")
|
@@ -60,15 +60,16 @@ def infer(
|
|
60 |
width=width,
|
61 |
height=height,
|
62 |
generator=generator,
|
|
|
63 |
).images[0]
|
64 |
|
65 |
return image, seed
|
66 |
|
67 |
|
68 |
examples = [
|
69 |
-
"Sticker
|
70 |
-
"
|
71 |
-
"
|
72 |
]
|
73 |
|
74 |
css = """
|
@@ -79,10 +80,13 @@ css = """
|
|
79 |
"""
|
80 |
|
81 |
def update_controlnet_visibility(controlnet_enabled):
|
82 |
-
|
|
|
83 |
|
84 |
def update_ip_adapter_visibility(ip_adapter_enabled):
|
85 |
-
|
|
|
|
|
86 |
|
87 |
|
88 |
with gr.Blocks(css=css) as demo:
|
|
|
45 |
|
46 |
pipe = None
|
47 |
if (model_id=="stable-diffusion-v1-5/stable-diffusion-v1-5 with lora"):
|
48 |
+
pipe=DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype)
|
49 |
pipe.unet = PeftModel.from_pretrained(pipe.unet,"um235/cartoon_cat_stickers")
|
50 |
else:
|
51 |
print("stable-diffusion-v1-5/stable-diffusion-v1-5 with lora")
|
|
|
60 |
width=width,
|
61 |
height=height,
|
62 |
generator=generator,
|
63 |
+
cross_attention_kwargs={"scale": lscale}
|
64 |
).images[0]
|
65 |
|
66 |
return image, seed
|
67 |
|
68 |
|
69 |
examples = [
|
70 |
+
"Sticker VanillaCat. Cartoon-style cat with soft yellow fur and a white flower on its head, sitting up with a relaxed expression, eyes half-closed, content and calm, casual pose, peaceful mood, white background.",
|
71 |
+
"Sticker VanillaCat. Cartoon-style cat with soft yellow fur and a white flower on its head, standing with a mischievous grin, one paw raised playfully, bright eyes full of energy, cheeky and fun, white background",
|
72 |
+
"VanillaCat. Cartoon-style cat with soft yellow fur and a white flower on its head, jumping mid-air with a surprised expression, wide eyes, and mouth open in excitement, paws stretched out, energetic and playful, white background.",
|
73 |
]
|
74 |
|
75 |
css = """
|
|
|
80 |
"""
|
81 |
|
82 |
def update_controlnet_visibility(controlnet_enabled):
|
83 |
+
# Возвращаем два значения для обновления видимости control_strength и control_mode
|
84 |
+
return gr.update(visible=controlnet_enabled), gr.update(visible=controlnet_enabled), gr.update(visible=controlnet_enabled)
|
85 |
|
86 |
def update_ip_adapter_visibility(ip_adapter_enabled):
|
87 |
+
# Возвращаем два значения для обновления видимости ip_adapter_scale и ip_adapter_image
|
88 |
+
return gr.update(visible=ip_adapter_enabled), gr.update(visible=ip_adapter_enabled)
|
89 |
+
|
90 |
|
91 |
|
92 |
with gr.Blocks(css=css) as demo:
|