Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,8 @@ import torch
|
|
| 3 |
import numpy as np
|
| 4 |
import cv2
|
| 5 |
from diffusers import StableDiffusionPipeline
|
| 6 |
-
from model import UNet2DConditionModelEx
|
|
|
|
| 7 |
from PIL import Image
|
| 8 |
import os
|
| 9 |
from huggingface_hub import login
|
|
@@ -22,7 +23,7 @@ unet = UNet2DConditionModelEx.from_pretrained(
|
|
| 22 |
torch_dtype=dtype
|
| 23 |
)
|
| 24 |
|
| 25 |
-
# Add conditioning
|
| 26 |
unet = unet.add_extra_conditions("ow-gbi-control-lora")
|
| 27 |
|
| 28 |
# Create the pipeline with custom UNet
|
|
@@ -58,7 +59,8 @@ def generate_image(input_image, prompt, negative_prompt, guidance_scale, steps,
|
|
| 58 |
negative_prompt=negative_prompt,
|
| 59 |
num_inference_steps=steps,
|
| 60 |
guidance_scale=guidance_scale,
|
| 61 |
-
image=canny_image
|
|
|
|
| 62 |
).images[0]
|
| 63 |
|
| 64 |
return canny_image, image
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import cv2
|
| 5 |
from diffusers import StableDiffusionPipeline
|
| 6 |
+
from model import UNet2DConditionModelEx
|
| 7 |
+
from pipeline import StableDiffusionControlLoraV3Pipeline
|
| 8 |
from PIL import Image
|
| 9 |
import os
|
| 10 |
from huggingface_hub import login
|
|
|
|
| 23 |
torch_dtype=dtype
|
| 24 |
)
|
| 25 |
|
| 26 |
+
# Add conditioning with ow-gbi-control-lora
|
| 27 |
unet = unet.add_extra_conditions("ow-gbi-control-lora")
|
| 28 |
|
| 29 |
# Create the pipeline with custom UNet
|
|
|
|
| 59 |
negative_prompt=negative_prompt,
|
| 60 |
num_inference_steps=steps,
|
| 61 |
guidance_scale=guidance_scale,
|
| 62 |
+
image=canny_image,
|
| 63 |
+
extra_condition_scale=1.0
|
| 64 |
).images[0]
|
| 65 |
|
| 66 |
return canny_image, image
|