linoyts HF staff commited on
Commit
4285cd4
·
verified ·
1 Parent(s): 085a529

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -122,7 +122,7 @@ def end_session(req: gr.Request):
122
  user_dir = os.path.join(TMP_DIR, str(req.session_hash))
123
  shutil.rmtree(user_dir)
124
 
125
-
126
  def preprocess_image(image: Image.Image,
127
  prompt: str = "",
128
  negative_prompt: str = "",
@@ -557,8 +557,8 @@ if __name__ == "__main__":
557
  pipe_control.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe_control.scheduler.config)
558
  pipe_control.to(device)
559
 
560
- # try:
561
- # pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
562
- # except:
563
- # pass
564
  demo.launch()
 
122
  user_dir = os.path.join(TMP_DIR, str(req.session_hash))
123
  shutil.rmtree(user_dir)
124
 
125
+ @spaces.GPU
126
  def preprocess_image(image: Image.Image,
127
  prompt: str = "",
128
  negative_prompt: str = "",
 
557
  pipe_control.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe_control.scheduler.config)
558
  pipe_control.to(device)
559
 
560
+ try:
561
+ pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
562
+ except:
563
+ pass
564
  demo.launch()