elungky commited on
Commit
86ed0ec
·
1 Parent(s): 1e34ce9

Fix ModuleNotFoundError: Add /app/gui/api to PYTHONPATH

Browse files
Files changed (1) hide show
  1. start.sh +5 -17
start.sh CHANGED
@@ -2,27 +2,15 @@
2
  set -eux # Keep this for debugging and seeing command execution
3
 
4
  export CUDA_VISIBLE_DEVICES="0"
5
- export CUDA_HOME="/usr/local/cuda" # Robust CUDA_HOME for Docker environment
6
- export PYTHONPATH="/app" # Set Python path to the app root
 
 
7
 
8
  echo "Starting GEN3C FastAPI inference server..."
9
 
10
- # Set environment variables as per GEN3C guide
11
- # Assuming 'checkpoints' folder is directly under '/app'
12
  export GEN3C_CKPT_PATH="/app/checkpoints"
13
- export GEN3C_GPU_COUNT=1 # Explicitly use 1 GPU for A100 instance
14
-
15
- # Navigate to the 'gui' directory where server.py resides, if necessary
16
- # The current directory is /app, and server.py is at /app/gui/api/server.py
17
- # So we need to ensure the path is correct from /app
18
- # Or, you can CD into the directory: cd gui
19
- # For now, let's keep the path explicit.
20
 
21
  # Start the FastAPI server
22
- # Using 'uvicorn' directly is often preferred over 'fastapi dev' for deployment,
23
- # as 'fastapi dev' is more for development with auto-reload.
24
- # 'uvicorn' is typically installed with 'fastapi[standard]' or 'uvicorn[standard]'
25
- # The format is 'uvicorn <module>:<app_instance>'
26
- # So if server.py has 'app = FastAPI()', it's 'gui.api.server:app'
27
- # We need to bind to 0.0.0.0 and port 7860 for HF Spaces
28
  exec uvicorn gui.api.server:app --host 0.0.0.0 --port 7860 --proxy-headers
 
2
  set -eux # Keep this for debugging and seeing command execution
3
 
4
  export CUDA_VISIBLE_DEVICES="0"
5
+ export CUDA_HOME="/usr/local/cuda"
6
+
7
+ # Add /app/gui/api to PYTHONPATH so api_types can be found directly
8
+ export PYTHONPATH="/app:/app/gui/api"
9
 
10
  echo "Starting GEN3C FastAPI inference server..."
11
 
 
 
12
  export GEN3C_CKPT_PATH="/app/checkpoints"
13
+ export GEN3C_GPU_COUNT=1
 
 
 
 
 
 
14
 
15
  # Start the FastAPI server
 
 
 
 
 
 
16
  exec uvicorn gui.api.server:app --host 0.0.0.0 --port 7860 --proxy-headers