Spaces:
Runtime error
Runtime error
lionelgarnier
commited on
Commit
·
f58427d
1
Parent(s):
1a528f5
cuda trellis
Browse files
app.py
CHANGED
@@ -67,7 +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 |
-
trellis.cuda()
|
71 |
processed_image = trellis.preprocess_image(image)
|
72 |
return processed_image
|
73 |
|
@@ -125,13 +125,6 @@ def get_trellis_pipeline():
|
|
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
|
@@ -331,6 +324,9 @@ def image_to_3d(
|
|
331 |
if pipeline is None:
|
332 |
return None, "Trellis pipeline is unavailable."
|
333 |
|
|
|
|
|
|
|
334 |
outputs = pipeline.run(
|
335 |
image,
|
336 |
seed=seed,
|
|
|
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 |
except Exception as e:
|
129 |
print(f"Error loading Trellis pipeline: {e}")
|
130 |
return None
|
|
|
324 |
if pipeline is None:
|
325 |
return None, "Trellis pipeline is unavailable."
|
326 |
|
327 |
+
# Call cuda() here in the GPU worker process
|
328 |
+
pipeline.cuda()
|
329 |
+
|
330 |
outputs = pipeline.run(
|
331 |
image,
|
332 |
seed=seed,
|