dkatz2391 commited on
Commit
5af1eea
·
verified ·
1 Parent(s): d08c80a

got kinda close it actually posted to server but epmpyt file

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -13,6 +13,7 @@ from easydict import EasyDict as edict
13
  from trellis.pipelines import TrellisTextTo3DPipeline
14
  from trellis.representations import Gaussian, MeshExtractResult
15
  from trellis.utils import render_utils, postprocessing_utils
 
16
 
17
  import traceback
18
  import sys
@@ -212,10 +213,17 @@ def generate_and_extract_glb(
212
  if glb_path is None:
213
  logging.error(f"[{request_hash}] Internal extract_glb returned None path!")
214
  raise ValueError("Internal extract_glb failed to return GLB path")
215
- logging.info(f"[{request_hash}] Internal extract_glb completed. GLB path: {glb_path}")
216
-
217
- logging.info(f"[{request_hash}] EXIT generate_and_extract_glb - Returning path: {glb_path}")
218
- return glb_path
 
 
 
 
 
 
 
219
 
220
  except Exception as e:
221
  logging.error(f"[{request_hash}] ERROR in generate_and_extract_glb: {e}", exc_info=True)
 
13
  from trellis.pipelines import TrellisTextTo3DPipeline
14
  from trellis.representations import Gaussian, MeshExtractResult
15
  from trellis.utils import render_utils, postprocessing_utils
16
+ from gradio.processing_utils import move_resource_to_block_cache
17
 
18
  import traceback
19
  import sys
 
213
  if glb_path is None:
214
  logging.error(f"[{request_hash}] Internal extract_glb returned None path!")
215
  raise ValueError("Internal extract_glb failed to return GLB path")
216
+ logging.info(f"[{request_hash}] Internal extract_glb completed. Original GLB path: {glb_path}")
217
+
218
+ try:
219
+ cached_glb_path = move_resource_to_block_cache(glb_path, demo)
220
+ logging.info(f"[{request_hash}] Copied GLB to Gradio cache: {cached_glb_path}")
221
+ logging.info(f"[{request_hash}] EXIT generate_and_extract_glb - Returning cached path: {cached_glb_path}")
222
+ return cached_glb_path
223
+ except Exception as cache_err:
224
+ logging.error(f"[{request_hash}] ERROR copying GLB to Gradio cache: {cache_err}", exc_info=True)
225
+ logging.warning(f"[{request_hash}] Falling back to returning original path: {glb_path}")
226
+ return glb_path
227
 
228
  except Exception as e:
229
  logging.error(f"[{request_hash}] ERROR in generate_and_extract_glb: {e}", exc_info=True)