gensym commited on
Commit
ee3dbc1
·
1 Parent(s): 6a3f855
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -273,13 +273,17 @@ def cleanup_tmp_dir():
273
  cleanup_thread = threading.Thread(target=cleanup_tmp_dir)
274
  cleanup_thread.start()
275
 
276
-
277
- # Launch the Gradio app
278
- if __name__ == "__main__":
279
  pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
280
  pipeline.cuda()
281
  try:
282
  pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
283
  except:
284
  pass
 
 
 
 
285
  demo.launch()
 
273
  cleanup_thread = threading.Thread(target=cleanup_tmp_dir)
274
  cleanup_thread.start()
275
 
276
+ @spaces.GPU
277
+ def preload():
278
+ global pipeline
279
  pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
280
  pipeline.cuda()
281
  try:
282
  pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
283
  except:
284
  pass
285
+
286
+ # Launch the Gradio app
287
+ if __name__ == "__main__":
288
+ preload()
289
  demo.launch()