-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcortex-api
More file actions
executable file
·28 lines (24 loc) · 836 Bytes
/
cortex-api
File metadata and controls
executable file
·28 lines (24 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Neo-Cortex REST API launcher
# Usage: ./cortex-api
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Find Python in priority order:
# 1. CORTEX_PYTHON env var (explicit override)
# 2. Local venv in neo-cortex directory
# 3. Active virtual environment
# 4. System python3
if [ -n "$CORTEX_PYTHON" ] && [ -f "$CORTEX_PYTHON" ]; then
PYTHON="$CORTEX_PYTHON"
elif [ -f "$SCRIPT_DIR/venv/bin/python" ]; then
PYTHON="$SCRIPT_DIR/venv/bin/python"
elif [ -n "$VIRTUAL_ENV" ] && [ -f "$VIRTUAL_ENV/bin/python" ]; then
PYTHON="$VIRTUAL_ENV/bin/python"
else
PYTHON="$(command -v python3 || command -v python)"
fi
if [ -z "$PYTHON" ]; then
echo "Error: No Python found. Create a venv in $SCRIPT_DIR or set CORTEX_PYTHON." >&2
exit 1
fi
cd "$SCRIPT_DIR"
exec "$PYTHON" -m service.api_server "$@"