Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,12 +26,13 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
| 26 |
variant="fp16",
|
| 27 |
use_safetensors=True
|
| 28 |
)
|
|
|
|
| 29 |
|
| 30 |
custom_model = "fffiloni/eugene_jour_general"
|
| 31 |
|
| 32 |
# This is where you load your trained weights
|
| 33 |
pipe.load_lora_weights(custom_model, use_auth_token=True)
|
| 34 |
-
|
| 35 |
#pipe.enable_model_cpu_offload()
|
| 36 |
|
| 37 |
def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
|
|
@@ -48,13 +49,16 @@ def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
|
|
| 48 |
image = np.concatenate([image, image, image], axis=2)
|
| 49 |
image = Image.fromarray(image)
|
| 50 |
|
|
|
|
|
|
|
| 51 |
images = pipe(
|
| 52 |
prompt,
|
| 53 |
negative_prompt=negative_prompt,
|
| 54 |
image=image,
|
| 55 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
| 56 |
guidance_scale = guidance_scale,
|
| 57 |
-
num_inference_steps=50
|
|
|
|
| 58 |
).images
|
| 59 |
|
| 60 |
images[0].save(f"hug_lab.png")
|
|
|
|
| 26 |
variant="fp16",
|
| 27 |
use_safetensors=True
|
| 28 |
)
|
| 29 |
+
pipe.to("cuda")
|
| 30 |
|
| 31 |
custom_model = "fffiloni/eugene_jour_general"
|
| 32 |
|
| 33 |
# This is where you load your trained weights
|
| 34 |
pipe.load_lora_weights(custom_model, use_auth_token=True)
|
| 35 |
+
|
| 36 |
#pipe.enable_model_cpu_offload()
|
| 37 |
|
| 38 |
def infer(image_in, prompt, controlnet_conditioning_scale, guidance_scale):
|
|
|
|
| 49 |
image = np.concatenate([image, image, image], axis=2)
|
| 50 |
image = Image.fromarray(image)
|
| 51 |
|
| 52 |
+
lora_scale= 0.9
|
| 53 |
+
|
| 54 |
images = pipe(
|
| 55 |
prompt,
|
| 56 |
negative_prompt=negative_prompt,
|
| 57 |
image=image,
|
| 58 |
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
| 59 |
guidance_scale = guidance_scale,
|
| 60 |
+
num_inference_steps=50,
|
| 61 |
+
cross_attention_kwargs={"scale": lora_scale}
|
| 62 |
).images
|
| 63 |
|
| 64 |
images[0].save(f"hug_lab.png")
|