From bb74d2dabf72e047f3d4f7ea3e781211088df994 Mon Sep 17 00:00:00 2001 From: Younes Brahimi <43382860+younesbram@users.noreply.github.com> Date: Tue, 3 Jun 2025 00:13:19 -0700 Subject: [PATCH] make it initialize upper Fixes NameError when Gradio tries to cache examples by moving the pipeline init from main block to module level --- app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index bd859467..3db878c5 100644 --- a/app.py +++ b/app.py @@ -13,6 +13,9 @@ from trellis.representations import Gaussian, MeshExtractResult from trellis.utils import render_utils, postprocessing_utils +# initialize pipeline at module level +pipeline = TrellisImageTo3DPipeline.from_pretrained("microsoft/TRELLIS-image-large") +pipeline.cuda() MAX_SEED = np.iinfo(np.int32).max TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp') @@ -398,6 +401,4 @@ def split_image(image: Image.Image) -> List[Image.Image]: # Launch the Gradio app if __name__ == "__main__": - pipeline = TrellisImageTo3DPipeline.from_pretrained("microsoft/TRELLIS-image-large") - pipeline.cuda() demo.launch()