um235 commited on
Commit
452e572
·
verified ·
1 Parent(s): 2c22c94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
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,cross_attention_kwargs={"scale": lscale})
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, cartoon-style cat character with soft yellow fur. A gentle cat with expressive eyes that shine with a sad, emotional look. The cat, with a small pink nose and a flower on its head, appears to be crying, with blue teardrops around its eyes, giving the sticker a simple yet poignant design.",
70
- "An astronaut riding a green horse",
71
- "A delicious ceviche cheesecake slice",
72
  ]
73
 
74
  css = """
@@ -79,10 +80,13 @@ css = """
79
  """
80
 
81
  def update_controlnet_visibility(controlnet_enabled):
82
- return {"visible": controlnet_enabled}
 
83
 
84
  def update_ip_adapter_visibility(ip_adapter_enabled):
85
- return {"visible": ip_adapter_enabled}
 
 
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: