amos1088 commited on
Commit
6fc2fae
·
1 Parent(s): 0737dc8

test gradio

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -15,9 +15,9 @@ import os
15
  token = os.getenv("HF_TOKEN")
16
  login(token=token)
17
 
18
- # Model and ControlNet IDs
19
- model_id = "runwayml/stable-diffusion-v1-5" # Known compatible model with ControlNet
20
- controlnet_id = "lllyasviel/sd-controlnet-canny" # ControlNet model for edge detection
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()