Spaces:
Running
on
Zero
Running
on
Zero
Update controlnet/callable_functions.py
Browse files
controlnet/callable_functions.py
CHANGED
@@ -10,7 +10,7 @@ from transformers import AutoProcessor, SiglipVisionModel
|
|
10 |
|
11 |
|
12 |
|
13 |
-
def
|
14 |
# Load and preprocess image
|
15 |
# Set up model components
|
16 |
unet = UNet2DConditionModel.from_pretrained("runwayml/stable-diffusion-v1-5", subfolder="unet", torch_dtype=torch.float16, device="cuda")
|
@@ -52,11 +52,12 @@ def process_single_image(model,image_path, prompt, num_inference_steps, stylecod
|
|
52 |
# Run the image through the pipeline with the specified prompt
|
53 |
output_images = pipe(
|
54 |
prompt=prompt,
|
|
|
55 |
guidance_scale=3,
|
56 |
#image=image,
|
57 |
num_inference_steps=num_inference_steps,
|
58 |
generator=generator,
|
59 |
-
controlnet_conditioning_scale=0.
|
60 |
width=512,
|
61 |
height=512,
|
62 |
stylecode=stylecode,
|
@@ -88,7 +89,7 @@ def process_single_image_both_ways(model,image_path, prompt, num_inference_steps
|
|
88 |
stylecodes_model=stylecodes_model,
|
89 |
torch_dtype=torch.float16,
|
90 |
device="cuda",
|
91 |
-
scheduler=noise_scheduler,
|
92 |
feature_extractor=None,
|
93 |
safety_checker=None,
|
94 |
)
|
@@ -110,7 +111,7 @@ def process_single_image_both_ways(model,image_path, prompt, num_inference_steps
|
|
110 |
image=image,
|
111 |
num_inference_steps=num_inference_steps,
|
112 |
generator=generator,
|
113 |
-
controlnet_conditioning_scale=0.
|
114 |
width=512,
|
115 |
height=512,
|
116 |
stylecode=None,
|
|
|
10 |
|
11 |
|
12 |
|
13 |
+
def use_stylecode(model,image_path, prompt,negative_prompt, num_inference_steps, stylecode,image=None):
|
14 |
# Load and preprocess image
|
15 |
# Set up model components
|
16 |
unet = UNet2DConditionModel.from_pretrained("runwayml/stable-diffusion-v1-5", subfolder="unet", torch_dtype=torch.float16, device="cuda")
|
|
|
52 |
# Run the image through the pipeline with the specified prompt
|
53 |
output_images = pipe(
|
54 |
prompt=prompt,
|
55 |
+
negative_prompt=negative_prompt,
|
56 |
guidance_scale=3,
|
57 |
#image=image,
|
58 |
num_inference_steps=num_inference_steps,
|
59 |
generator=generator,
|
60 |
+
controlnet_conditioning_scale=0.9,
|
61 |
width=512,
|
62 |
height=512,
|
63 |
stylecode=stylecode,
|
|
|
89 |
stylecodes_model=stylecodes_model,
|
90 |
torch_dtype=torch.float16,
|
91 |
device="cuda",
|
92 |
+
#scheduler=noise_scheduler,
|
93 |
feature_extractor=None,
|
94 |
safety_checker=None,
|
95 |
)
|
|
|
111 |
image=image,
|
112 |
num_inference_steps=num_inference_steps,
|
113 |
generator=generator,
|
114 |
+
controlnet_conditioning_scale=0.9,
|
115 |
width=512,
|
116 |
height=512,
|
117 |
stylecode=None,
|