-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
96 lines (83 loc) · 3.51 KB
/
Copy pathsetup.sh
File metadata and controls
96 lines (83 loc) · 3.51 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
# SatQuery AI — one-command setup for macOS / Linux.
# Creates a virtual environment, installs the dependencies, copies the
# environment template to .env with a back-end that works with no GPU,
# and prints exactly what to run next.
set -euo pipefail
cd "$(dirname "$0")"
echo "==> SatQuery AI setup"
# --- Check Python (3.10+ required by the dependencies that are pinned) ---
PY=python3
if ! command -v "$PY" >/dev/null 2>&1; then
PY=python
fi
if ! command -v "$PY" >/dev/null 2>&1; then
echo "ERROR: Python was not found on PATH." >&2
echo "Install Python 3.10 or newer (https://www.python.org/downloads/)" \
"and re-run this script." >&2
exit 1
fi
PYVER=$("$PY" -c 'import sys; print("%d.%d" % sys.version_info[:2])')
"$PY" -c 'import sys; exit(0 if sys.version_info >= (3, 10) else 1)' || {
echo "ERROR: Python $PYVER found, but 3.10+ is required." >&2
exit 1
}
echo "Python: $("$PY" --version) at $(command -v "$PY")"
# --- Virtual environment ---
if [ ! -d ".venv" ]; then
echo "Creating virtual environment .venv ..."
"$PY" -m venv .venv
else
echo "Virtual environment .venv already exists — reusing it."
fi
PYEXE=".venv/bin/python"
# --- Dependencies (main requirements; the model weights are NOT included) ---
echo "Installing dependencies from requirements.txt (this can take a few minutes) ..."
"$PYEXE" -m pip install --quiet --upgrade pip
"$PYEXE" -m pip install --quiet -r requirements.txt
# --- Environment file ---
if [ -f ".env" ]; then
echo "Existing .env kept untouched."
else
cp .env.example .env
# 'stub' answers queries with deterministic canned outputs and no model
# weights, so the app runs immediately on a laptop with no GPU. The
# README's Colab section explains how to switch to the real model.
if command -v sed >/dev/null 2>&1; then
sed -i.bak 's/^MODEL_BACKEND=local$/MODEL_BACKEND=stub/' .env && rm -f .env.bak
fi
echo "Created .env from .env.example (MODEL_BACKEND set to 'stub' for the first run)."
fi
# --- Sanity check: the agent stack imports and the test suite is runnable ---
echo "Verifying the installation (import check) ..."
"$PYEXE" -c "from agent.planner import AgentController" \
|| { echo "ERROR: import check failed — see the messages above." >&2; exit 1; }
cat <<'EOF'
============================================================
Setup complete.
To start the app:
source .venv/bin/activate
streamlit run app/frontend/app.py
...then open http://localhost:8501 in a browser.
Or run the browser app (README "Setup 1b"): in a second terminal,
cd app/frontend-web && npm install && npm run dev
...then open http://localhost:3000 (API on port 8000):
source .venv/bin/activate
uvicorn app.webapi.server:app --port 8000
The first run uses MODEL_BACKEND=stub: every query returns a
deterministic, clearly-labelled canned answer while the back-end
switch keeps working, so you can explore the whole interface with
no GPU. To run the real remote-sensing model:
1. Open the free Colab notebook — follow the section
"Run the model backend on Colab" in README.md
2. Copy the tunnel URL it prints
3. In .env set:
MODEL_BACKEND=remote
SATQUERY_REMOTE_URL=<the tunnel URL>
4. Restart the app.
Useful extras:
pytest tests -q run the test suite
python -m pytest -q (same, inside the venv)
docs/DEMO.md demo script for the five queries
============================================================
EOF