lionelgarnier commited on
Commit
1a528f5
·
1 Parent(s): c4611b8

move trellis cuda

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -67,6 +67,7 @@ def preprocess_image(image: Image.Image) -> Image.Image:
67
  if trellis is None:
68
  # If the pipeline is not loaded, just return the original image
69
  return image
 
70
  processed_image = trellis.preprocess_image(image)
71
  return processed_image
72
 
@@ -124,13 +125,13 @@ def get_trellis_pipeline():
124
  try:
125
  print("Loading Trellis pipeline...")
126
  _trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
127
- _trellis_pipeline.cuda()
128
 
129
- # Preload rembg by processing a small test image
130
- try:
131
- _trellis_pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8)))
132
- except Exception as e:
133
- print(f"Warning when preloading rembg: {e}")
134
  except Exception as e:
135
  print(f"Error loading Trellis pipeline: {e}")
136
  return None
 
67
  if trellis is None:
68
  # If the pipeline is not loaded, just return the original image
69
  return image
70
+ trellis.cuda()
71
  processed_image = trellis.preprocess_image(image)
72
  return processed_image
73
 
 
125
  try:
126
  print("Loading Trellis pipeline...")
127
  _trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
128
+ # _trellis_pipeline.cuda()
129
 
130
+ # # Preload rembg by processing a small test image
131
+ # try:
132
+ # _trellis_pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8)))
133
+ # except Exception as e:
134
+ # print(f"Warning when preloading rembg: {e}")
135
  except Exception as e:
136
  print(f"Error loading Trellis pipeline: {e}")
137
  return None