Spaces:
Runtime error
Runtime error
Update controlnet/callable_functions.py
Browse files
controlnet/callable_functions.py
CHANGED
|
@@ -8,7 +8,7 @@ from controlnet.controlnetxs_appearance import StyleCodesModel
|
|
| 8 |
from diffusers.models import UNet2DConditionModel
|
| 9 |
from transformers import AutoProcessor, SiglipVisionModel
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
def use_stylecode(model,image_path, prompt,negative_prompt, num_inference_steps, stylecode,seed=None,image=None):
|
| 14 |
# Load and preprocess image
|
|
@@ -41,7 +41,9 @@ def use_stylecode(model,image_path, prompt,negative_prompt, num_inference_steps,
|
|
| 41 |
if seed is not None and seed != -1:
|
| 42 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 43 |
else:
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# Run the image through the pipeline with the specified prompt
|
| 47 |
output_images = pipe(
|
|
|
|
| 8 |
from diffusers.models import UNet2DConditionModel
|
| 9 |
from transformers import AutoProcessor, SiglipVisionModel
|
| 10 |
|
| 11 |
+
import random
|
| 12 |
|
| 13 |
def use_stylecode(model,image_path, prompt,negative_prompt, num_inference_steps, stylecode,seed=None,image=None):
|
| 14 |
# Load and preprocess image
|
|
|
|
| 41 |
if seed is not None and seed != -1:
|
| 42 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 43 |
else:
|
| 44 |
+
random_seed = random.randint(0, 2**32 - 1)
|
| 45 |
+
print("using random seed ",random_seed)
|
| 46 |
+
generator = torch.Generator(device="cuda").manual_seed(random_seed)
|
| 47 |
|
| 48 |
# Run the image through the pipeline with the specified prompt
|
| 49 |
output_images = pipe(
|