Staticaliza commited on
Commit
ceadb77
·
verified ·
1 Parent(s): c8f5737

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -7,7 +7,7 @@ import numpy
7
  import uuid
8
  import json
9
  import os
10
- from diffusers import StableDiffusionXLPipeline, ControlNetModel, EulerAncestralDiscreteScheduler
11
  from PIL import Image
12
 
13
  # Pre-Initialize
@@ -19,14 +19,15 @@ print(f"[SYSTEM] | Using {DEVICE} type compute device.")
19
  # Variables
20
  MAX_SEED = 9007199254740991
21
  DEFAULT_INPUT = ""
22
- DEFAULT_NEGATIVE_INPUT = "(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, NSFW"
23
  DEFAULT_HEIGHT = 1024
24
  DEFAULT_WIDTH = 1024
25
 
26
  REPO = "sd-community/sdxl-flash"
27
 
28
- model = StableDiffusionXLPipeline.from_pretrained(REPO, torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
29
- #model.scheduler = EulerAncestralDiscreteScheduler.from_config(model.scheduler.config)
 
30
  model.load_lora_weights("ehristoforu/dalle-3-xl-v2", adapter_name="base")
31
  model.set_adapters(["base"], adapter_weights=[0.7])
32
  model.to(DEVICE)
@@ -68,6 +69,7 @@ def generate(input=DEFAULT_INPUT, negative_input=DEFAULT_NEGATIVE_INPUT, height=
68
  "num_inference_steps": steps,
69
  "guidance_scale": guidance,
70
  "num_images_per_prompt": number,
 
71
  "cross_attention_kwargs": {"scale": 1},
72
  "generator": torch.Generator().manual_seed(seed),
73
  "use_resolution_binning": True,
 
7
  import uuid
8
  import json
9
  import os
10
+ from diffusers import StableDiffusionXLPipeline, ControlNetModel
11
  from PIL import Image
12
 
13
  # Pre-Initialize
 
19
  # Variables
20
  MAX_SEED = 9007199254740991
21
  DEFAULT_INPUT = ""
22
+ DEFAULT_NEGATIVE_INPUT = "deformed, distorted, disfigured, disconnected, disgusting, mutation, mutated, blur, blurry, scribble, abstract, ugly, amputation, limb, limbs, leg, legs, foot, feet, toe, toes, arm, arms, hand, hands, finger, fingers, head, heads, exposed, porn, nude, nudity, naked, nsfw, NSFW"
23
  DEFAULT_HEIGHT = 1024
24
  DEFAULT_WIDTH = 1024
25
 
26
  REPO = "sd-community/sdxl-flash"
27
 
28
+ controlnet = ControlNetModel.from_pretrained("MakiPan/controlnet-encoded-hands-130k", torch_dtype=torch.float32)
29
+
30
+ model = StableDiffusionXLPipeline.from_pretrained(REPO, controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
31
  model.load_lora_weights("ehristoforu/dalle-3-xl-v2", adapter_name="base")
32
  model.set_adapters(["base"], adapter_weights=[0.7])
33
  model.to(DEVICE)
 
69
  "num_inference_steps": steps,
70
  "guidance_scale": guidance,
71
  "num_images_per_prompt": number,
72
+ "controlnet_conditioning_scale": 0.5,
73
  "cross_attention_kwargs": {"scale": 1},
74
  "generator": torch.Generator().manual_seed(seed),
75
  "use_resolution_binning": True,