Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
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()
|