Spaces:
Runtime error
Runtime error
rename test
Browse files- pipelines/controlnetLoraSD15.py +11 -11
pipelines/controlnetLoraSD15.py
CHANGED
|
@@ -45,12 +45,12 @@ class Pipeline:
|
|
| 45 |
field="textarea",
|
| 46 |
id="prompt",
|
| 47 |
)
|
| 48 |
-
|
| 49 |
"plasmo/woolitize",
|
| 50 |
title="Base Model",
|
| 51 |
values=list(base_models.keys()),
|
| 52 |
field="select",
|
| 53 |
-
id="
|
| 54 |
)
|
| 55 |
seed: int = Field(
|
| 56 |
2159232, min=0, title="Seed", field="seed", hide=True, id="seed"
|
|
@@ -150,20 +150,20 @@ class Pipeline:
|
|
| 150 |
self.pipes = {}
|
| 151 |
|
| 152 |
if args.safety_checker:
|
| 153 |
-
for
|
| 154 |
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
|
| 155 |
-
|
| 156 |
controlnet=controlnet_canny,
|
| 157 |
)
|
| 158 |
-
self.pipes[
|
| 159 |
else:
|
| 160 |
-
for
|
| 161 |
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
|
| 162 |
-
|
| 163 |
safety_checker=None,
|
| 164 |
controlnet=controlnet_canny,
|
| 165 |
)
|
| 166 |
-
self.pipes[
|
| 167 |
|
| 168 |
self.canny_torch = SobelOperator(device=device)
|
| 169 |
|
|
@@ -199,10 +199,10 @@ class Pipeline:
|
|
| 199 |
|
| 200 |
def predict(self, params: "Pipeline.InputParams") -> Image.Image:
|
| 201 |
generator = torch.manual_seed(params.seed)
|
| 202 |
-
print(f"Using model: {params.
|
| 203 |
-
pipe = self.pipes[params.
|
| 204 |
|
| 205 |
-
activation_token = base_models[params.
|
| 206 |
prompt = f"{activation_token} {params.prompt}"
|
| 207 |
prompt_embeds = pipe.compel_proc(prompt)
|
| 208 |
control_image = self.canny_torch(
|
|
|
|
| 45 |
field="textarea",
|
| 46 |
id="prompt",
|
| 47 |
)
|
| 48 |
+
base_model_id: str = Field(
|
| 49 |
"plasmo/woolitize",
|
| 50 |
title="Base Model",
|
| 51 |
values=list(base_models.keys()),
|
| 52 |
field="select",
|
| 53 |
+
id="base_model_id",
|
| 54 |
)
|
| 55 |
seed: int = Field(
|
| 56 |
2159232, min=0, title="Seed", field="seed", hide=True, id="seed"
|
|
|
|
| 150 |
self.pipes = {}
|
| 151 |
|
| 152 |
if args.safety_checker:
|
| 153 |
+
for base_model_id in base_models.keys():
|
| 154 |
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
|
| 155 |
+
base_model_id,
|
| 156 |
controlnet=controlnet_canny,
|
| 157 |
)
|
| 158 |
+
self.pipes[base_model_id] = pipe
|
| 159 |
else:
|
| 160 |
+
for base_model_id in base_models.keys():
|
| 161 |
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
|
| 162 |
+
base_model_id,
|
| 163 |
safety_checker=None,
|
| 164 |
controlnet=controlnet_canny,
|
| 165 |
)
|
| 166 |
+
self.pipes[base_model_id] = pipe
|
| 167 |
|
| 168 |
self.canny_torch = SobelOperator(device=device)
|
| 169 |
|
|
|
|
| 199 |
|
| 200 |
def predict(self, params: "Pipeline.InputParams") -> Image.Image:
|
| 201 |
generator = torch.manual_seed(params.seed)
|
| 202 |
+
print(f"Using model: {params.base_model_id}")
|
| 203 |
+
pipe = self.pipes[params.base_model_id]
|
| 204 |
|
| 205 |
+
activation_token = base_models[params.base_model_id]
|
| 206 |
prompt = f"{activation_token} {params.prompt}"
|
| 207 |
prompt_embeds = pipe.compel_proc(prompt)
|
| 208 |
control_image = self.canny_torch(
|