multimodalart HF staff commited on
Commit
b1b84dc
1 Parent(s): b111852

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -26,7 +26,6 @@ pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
26
  pipe.fuse_lora(lora_scale=0.125)
27
  pipe.transformer.to(torch.bfloat16)
28
  pipe.controlnet.to(torch.bfloat16)
29
- pipe.enable_model_cpu_offload()
30
 
31
  def can_expand(source_width, source_height, target_width, target_height, alignment):
32
  if alignment in ("Left", "Right") and source_width >= target_width:
@@ -134,6 +133,8 @@ def prepare_image_and_mask(image, width, height, overlap_percentage, resize_opti
134
 
135
  @spaces.GPU
136
  def inpaint(image, width, height, overlap_percentage, num_inference_steps, resize_option, custom_resize_percentage, prompt_input, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom, progress=gr.Progress(track_tqdm=True)):
 
 
137
  background, mask = prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom)
138
 
139
  if not can_expand(background.width, background.height, width, height, alignment):
 
26
  pipe.fuse_lora(lora_scale=0.125)
27
  pipe.transformer.to(torch.bfloat16)
28
  pipe.controlnet.to(torch.bfloat16)
 
29
 
30
  def can_expand(source_width, source_height, target_width, target_height, alignment):
31
  if alignment in ("Left", "Right") and source_width >= target_width:
 
133
 
134
  @spaces.GPU
135
  def inpaint(image, width, height, overlap_percentage, num_inference_steps, resize_option, custom_resize_percentage, prompt_input, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom, progress=gr.Progress(track_tqdm=True)):
136
+ pipe.enable_model_cpu_offload()
137
+
138
  background, mask = prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom)
139
 
140
  if not can_expand(background.width, background.height, width, height, alignment):