0xZohar commited on
Commit
76d6193
·
verified ·
1 Parent(s): 9ec1c8c

Fix: Use absolute config path for HuggingFace Spaces deployment

Browse files

ROOT CAUSE:
- demo.py line 59 used relative path: 'cube3d/configs/open_model_v0.5.yaml'
- In HF Spaces, working directory is /home/user/app/ (project root)
- Code files are in /home/user/app/code/
- Relative path resolved to: /home/user/app/cube3d/configs/... (WRONG)
- Correct path should be: /home/user/app/code/cube3d/configs/... (CORRECT)

ERROR MESSAGE:
FileNotFoundError: [Errno 2] No such file or directory:
'/home/user/app/cube3d/configs/open_model_v0.5.yaml'

SOLUTION:
- Changed config_path from relative to absolute path using os.path.dirname(__file__)
- Now resolves correctly regardless of working directory
- Compatible with both local development and HF Spaces deployment

CHANGES:
- code/demo.py line 59-60:
OLD: config_path = 'cube3d/configs/open_model_v0.5.yaml'
NEW: config_path = os.path.join(os.path.dirname(__file__), 'cube3d/configs/open_model_v0.5.yaml')

EXPECTED BEHAVIOR:
- Config file loads successfully
- GPT engine initializes without errors
- "Generate New LDR & Render" function works
- Label mapping warnings persist but don't block functionality

Files changed (1) hide show
  1. code/demo.py +2 -1
code/demo.py CHANGED
@@ -56,7 +56,8 @@ def get_gpt_engine_cached():
56
  """Lazy load GPT engine (initialized only once, cached)"""
57
  print("🔧 Initializing GPT engine (one-time setup)...")
58
 
59
- config_path = 'cube3d/configs/open_model_v0.5.yaml'
 
60
  gpt_ckpt_path = None # test mode doesn't use this
61
 
62
  # Detect HuggingFace Spaces environment
 
56
  """Lazy load GPT engine (initialized only once, cached)"""
57
  print("🔧 Initializing GPT engine (one-time setup)...")
58
 
59
+ # Use absolute path relative to this file (fixes HF Spaces deployment)
60
+ config_path = os.path.join(os.path.dirname(__file__), 'cube3d/configs/open_model_v0.5.yaml')
61
  gpt_ckpt_path = None # test mode doesn't use this
62
 
63
  # Detect HuggingFace Spaces environment