Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
# import spaces # Not
|
| 3 |
from gradio_litmodel3d import LitModel3D
|
| 4 |
|
| 5 |
import os
|
|
@@ -253,15 +253,14 @@ def split_image(image: Image.Image) -> List[Image.Image]:
|
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
-
#
|
| 257 |
pipeline = TrellisImageTo3DPipeline.from_pretrained("microsoft/TRELLIS-image-large")
|
| 258 |
pipeline.cuda()
|
| 259 |
try:
|
| 260 |
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
| 261 |
except:
|
| 262 |
pass
|
| 263 |
-
print("Pipeline loaded successfully")
|
| 264 |
-
|
| 265 |
|
| 266 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
| 267 |
gr.Markdown("""
|
|
@@ -414,5 +413,4 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 414 |
|
| 415 |
# Launch the Gradio app
|
| 416 |
if __name__ == "__main__":
|
| 417 |
-
pass
|
| 418 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
# import spaces # Not using ZeroGPU on dedicated L40S
|
| 3 |
from gradio_litmodel3d import LitModel3D
|
| 4 |
|
| 5 |
import os
|
|
|
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
+
# ===== Load pipeline at module level (dedicated L40S GPU) =====
|
| 257 |
pipeline = TrellisImageTo3DPipeline.from_pretrained("microsoft/TRELLIS-image-large")
|
| 258 |
pipeline.cuda()
|
| 259 |
try:
|
| 260 |
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
| 261 |
except:
|
| 262 |
pass
|
| 263 |
+
print("Pipeline loaded successfully on dedicated GPU")
|
|
|
|
| 264 |
|
| 265 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
| 266 |
gr.Markdown("""
|
|
|
|
| 413 |
|
| 414 |
# Launch the Gradio app
|
| 415 |
if __name__ == "__main__":
|
|
|
|
| 416 |
demo.launch()
|