mokady commited on
Commit
a6ab172
1 Parent(s): 7d0aa8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -47,7 +47,7 @@ from torchvision import transforms
47
  controlnet = ControlNetModel.from_pretrained(
48
  "briaai/BRIA-2.2-ControlNet-Canny",
49
  torch_dtype=torch.float16
50
- ).to('cuda')
51
 
52
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
53
  "briaai/BRIA-2.2",
@@ -56,7 +56,7 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
56
  device_map='auto',
57
  low_cpu_mem_usage=True,
58
  offload_state_dict=True,
59
- ).to('cuda')
60
  pipe.scheduler = EulerAncestralDiscreteScheduler(
61
  beta_start=0.00085,
62
  beta_end=0.012,
@@ -105,6 +105,7 @@ def process(input_image, prompt, negative_prompt, num_steps, controlnet_conditio
105
 
106
  @spaces.GPU
107
  def generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed):
 
108
  generator = torch.manual_seed(seed)
109
  images = pipe(
110
  prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),
 
47
  controlnet = ControlNetModel.from_pretrained(
48
  "briaai/BRIA-2.2-ControlNet-Canny",
49
  torch_dtype=torch.float16
50
+ ) #.to('cuda')
51
 
52
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
53
  "briaai/BRIA-2.2",
 
56
  device_map='auto',
57
  low_cpu_mem_usage=True,
58
  offload_state_dict=True,
59
+ ) #.to('cuda')
60
  pipe.scheduler = EulerAncestralDiscreteScheduler(
61
  beta_start=0.00085,
62
  beta_end=0.012,
 
105
 
106
  @spaces.GPU
107
  def generate_(prompt, negative_prompt, canny_image, num_steps, controlnet_conditioning_scale, seed):
108
+ pipe.to('cuda')
109
  generator = torch.manual_seed(seed)
110
  images = pipe(
111
  prompt, negative_prompt=negative_prompt, image=canny_image, num_inference_steps=num_steps, controlnet_conditioning_scale=float(controlnet_conditioning_scale),