LPX55 commited on
Commit
8788948
·
verified ·
1 Parent(s): c4bfaad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -15,6 +15,7 @@ import numpy as np
15
  MODELS = {
16
  "RealVisXL V5.0 Lightning": "SG161222/RealVisXL_V5.0_Lightning",
17
  "Lustify Lightning": "GraydientPlatformAPI/lustify-lightning",
 
18
  "Juggernaut XL Lightning": "RunDiffusion/Juggernaut-XL-Lightning",
19
  }
20
 
@@ -54,9 +55,17 @@ pipe = StableDiffusionXLFillPipeline.from_pretrained(
54
  controlnet=model,
55
  )
56
 
 
 
57
  pipe.to("cuda")
58
 
59
- pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
 
 
 
 
 
 
60
 
61
  @spaces.GPU(duration=16)
62
  def fill_image(prompt, image, model_selection, paste_back):
@@ -236,12 +245,15 @@ def inpaint(prompt, image, inpaint_model, paste_back):
236
  vae=vae,
237
  controlnet=model,
238
  ).to("cuda")
 
 
239
 
240
  mask = Image.fromarray(image["mask"]).convert("L")
241
  image = Image.fromarray(image["image"])
242
 
243
  result = pipe(prompt=prompt, image=image, mask_image=mask).images[0]
244
-
 
245
  if paste_back:
246
  result.paste(image, (0, 0), Image.fromarray(255 - np.array(mask)))
247
 
 
15
  MODELS = {
16
  "RealVisXL V5.0 Lightning": "SG161222/RealVisXL_V5.0_Lightning",
17
  "Lustify Lightning": "GraydientPlatformAPI/lustify-lightning",
18
+ "Lustify Inpaint": "andro-flock/LUSTIFY-SDXL-NSFW-checkpoint-v2-0-INPAINTING",
19
  "Juggernaut XL Lightning": "RunDiffusion/Juggernaut-XL-Lightning",
20
  }
21
 
 
55
  controlnet=model,
56
  )
57
 
58
+ pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
59
+
60
  pipe.to("cuda")
61
 
62
+ pipe_inpaint = StableDiffusionXLFillPipeline.from_pretrained(
63
+ "andro-flock/LUSTIFY-SDXL-NSFW-checkpoint-v2-0-INPAINTING",
64
+ torch_dtype=torch.float16,
65
+ vae=vae,
66
+ controlnet=model,
67
+ )
68
+ pipe_inpaint.to("cuda")
69
 
70
  @spaces.GPU(duration=16)
71
  def fill_image(prompt, image, model_selection, paste_back):
 
245
  vae=vae,
246
  controlnet=model,
247
  ).to("cuda")
248
+ # if pipe.config.model_name == "Lustify Inpaint":
249
+
250
 
251
  mask = Image.fromarray(image["mask"]).convert("L")
252
  image = Image.fromarray(image["image"])
253
 
254
  result = pipe(prompt=prompt, image=image, mask_image=mask).images[0]
255
+ # result = pipe_inpaint(prompt=prompt, image=image, mask_image=mask).images[0]
256
+
257
  if paste_back:
258
  result.paste(image, (0, 0), Image.fromarray(255 - np.array(mask)))
259