Update app.py
Browse fileschanged the code to mostly match the original
app.py
CHANGED
@@ -22,18 +22,6 @@ torch.cuda.empty_cache()
|
|
22 |
torch.cuda.set_per_process_memory_fraction(0.8) # Use only 80% of available GPU memory
|
23 |
|
24 |
|
25 |
-
# Initialize pipeline at module level
|
26 |
-
pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
27 |
-
pipeline.cuda()
|
28 |
-
try:
|
29 |
-
# Preload rembg
|
30 |
-
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8)))
|
31 |
-
except:
|
32 |
-
pass
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
MAX_SEED = np.iinfo(np.int32).max
|
38 |
TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
39 |
os.makedirs(TMP_DIR, exist_ok=True)
|
@@ -423,5 +411,10 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
423 |
|
424 |
# Launch the Gradio app
|
425 |
if __name__ == "__main__":
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
427 |
demo.launch()
|
|
|
22 |
torch.cuda.set_per_process_memory_fraction(0.8) # Use only 80% of available GPU memory
|
23 |
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
MAX_SEED = np.iinfo(np.int32).max
|
26 |
TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
27 |
os.makedirs(TMP_DIR, exist_ok=True)
|
|
|
411 |
|
412 |
# Launch the Gradio app
|
413 |
if __name__ == "__main__":
|
414 |
+
pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
415 |
+
pipeline.cuda()
|
416 |
+
try:
|
417 |
+
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
418 |
+
except:
|
419 |
+
pass
|
420 |
demo.launch()
|