Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -67,10 +67,7 @@ pipe_controlnet = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
|
|
67 |
torch_dtype=torch_dtype
|
68 |
).to(device)
|
69 |
|
70 |
-
def preprocess_image(image, target_width, target_height):
|
71 |
-
"""
|
72 |
-
Преобразует изображение в формат, подходящий для модели.
|
73 |
-
"""
|
74 |
if isinstance(image, np.ndarray):
|
75 |
image = Image.fromarray(image)
|
76 |
image = image.resize((target_width, target_height), Image.LANCZOS)
|
@@ -135,6 +132,7 @@ def infer(
|
|
135 |
|
136 |
# Убедимся, что control_strength имеет тип float
|
137 |
control_strength = float(control_strength)
|
|
|
138 |
|
139 |
# Используем ControlNet с LoRA
|
140 |
pipe = pipe_controlnet
|
@@ -322,7 +320,6 @@ with gr.Blocks(css=css) as demo:
|
|
322 |
use_control_net.change(
|
323 |
fn=lambda x: gr.Row.update(visible=x),
|
324 |
inputs=use_control_net,
|
325 |
-
#outputs=[control_net_options_1, control_net_options_2]
|
326 |
outputs=control_net_options
|
327 |
)
|
328 |
# --------------------------------------------------------------------------------------
|
|
|
67 |
torch_dtype=torch_dtype
|
68 |
).to(device)
|
69 |
|
70 |
+
def preprocess_image(image, target_width, target_height): # Преобразует изображение в формат, подходящий для модели.
|
|
|
|
|
|
|
71 |
if isinstance(image, np.ndarray):
|
72 |
image = Image.fromarray(image)
|
73 |
image = image.resize((target_width, target_height), Image.LANCZOS)
|
|
|
132 |
|
133 |
# Убедимся, что control_strength имеет тип float
|
134 |
control_strength = float(control_strength)
|
135 |
+
strength_sn = float(strength_sn)
|
136 |
|
137 |
# Используем ControlNet с LoRA
|
138 |
pipe = pipe_controlnet
|
|
|
320 |
use_control_net.change(
|
321 |
fn=lambda x: gr.Row.update(visible=x),
|
322 |
inputs=use_control_net,
|
|
|
323 |
outputs=control_net_options
|
324 |
)
|
325 |
# --------------------------------------------------------------------------------------
|