Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,16 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
22 |
TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
23 |
os.makedirs(TMP_DIR, exist_ok=True)
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
def start_session(req: gr.Request):
|
27 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
@@ -273,10 +283,4 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
273 |
|
274 |
# Launch the Gradio app
|
275 |
if __name__ == "__main__":
|
276 |
-
pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
277 |
-
pipeline.cuda()
|
278 |
-
try:
|
279 |
-
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
280 |
-
except:
|
281 |
-
pass
|
282 |
demo.launch()
|
|
|
22 |
TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
23 |
os.makedirs(TMP_DIR, exist_ok=True)
|
24 |
|
25 |
+
# Initialize pipeline here
|
26 |
+
pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
27 |
+
pipeline.cuda()
|
28 |
+
|
29 |
+
# Preload rembg (optional)
|
30 |
+
try:
|
31 |
+
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8)))
|
32 |
+
except:
|
33 |
+
pass
|
34 |
+
|
35 |
|
36 |
def start_session(req: gr.Request):
|
37 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
|
|
283 |
|
284 |
# Launch the Gradio app
|
285 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
demo.launch()
|