Spaces:
Paused
Paused
test gradio
Browse files
app.py
CHANGED
@@ -15,9 +15,9 @@ import os
|
|
15 |
token = os.getenv("HF_TOKEN")
|
16 |
login(token=token)
|
17 |
|
18 |
-
# Model and ControlNet
|
19 |
-
model_id = "
|
20 |
-
controlnet_id = "lllyasviel/
|
21 |
|
22 |
# Load ControlNet model and other components
|
23 |
controlnet = ControlNetModel.from_pretrained(controlnet_id, torch_dtype=torch.float16)
|
@@ -26,9 +26,7 @@ pipeline = StableDiffusionControlNetPipeline.from_pretrained(
|
|
26 |
controlnet=controlnet,
|
27 |
torch_dtype=torch.float16
|
28 |
)
|
29 |
-
|
30 |
-
# Optional: Set up the faster scheduler
|
31 |
-
pipeline.scheduler = UniPCMultistepScheduler.from_config(pipeline.scheduler.config)
|
32 |
|
33 |
# Enable CPU offloading for memory optimization
|
34 |
pipeline.enable_model_cpu_offload()
|
|
|
15 |
token = os.getenv("HF_TOKEN")
|
16 |
login(token=token)
|
17 |
|
18 |
+
# Model IDs for the base Stable Diffusion model and ControlNet variant
|
19 |
+
model_id = "stabilityai/stable-diffusion-3.5-large-turbo"
|
20 |
+
controlnet_id = "lllyasviel/control_v11p_sd15_inpaint" # Make sure this ControlNet is compatible
|
21 |
|
22 |
# Load ControlNet model and other components
|
23 |
controlnet = ControlNetModel.from_pretrained(controlnet_id, torch_dtype=torch.float16)
|
|
|
26 |
controlnet=controlnet,
|
27 |
torch_dtype=torch.float16
|
28 |
)
|
29 |
+
pipeline = pipeline.to("cuda") if torch.cuda.is_available() else pipeline
|
|
|
|
|
30 |
|
31 |
# Enable CPU offloading for memory optimization
|
32 |
pipeline.enable_model_cpu_offload()
|