loaai-rashad Claude Opus 4.8 commited on
Commit Β·
f709dcb
1
Parent(s): 45549b1
Add Hugging Face Spaces deploy config (free hosting)
Browse files- README frontmatter: sdk=docker, app_port=8000 (HF Space config)
- Dockerfile: chmod 777 /data so it's writable under HF's container user
- DEPLOY.md: Hugging Face Spaces steps (free) as the primary path, Render as paid alt
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- DEPLOY.md +32 -4
- Dockerfile +4 -2
- README.md +13 -0
DEPLOY.md
CHANGED
|
@@ -1,9 +1,37 @@
|
|
| 1 |
-
# Deploying
|
| 2 |
|
| 3 |
The app is packaged as a **single Docker image**: it builds the React frontend and
|
| 4 |
-
serves it together with the FastAPI API on one port
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
## One-time setup
|
| 9 |
|
|
|
|
| 1 |
+
# Deploying
|
| 2 |
|
| 3 |
The app is packaged as a **single Docker image**: it builds the React frontend and
|
| 4 |
+
serves it together with the FastAPI API on one port (8000).
|
| 5 |
+
|
| 6 |
+
## Option A β Hugging Face Spaces (free) β recommended for a demo
|
| 7 |
+
|
| 8 |
+
Free, permanent public URL, no credit card. The repo root already has the Space
|
| 9 |
+
config (the YAML block at the top of `README.md`: `sdk: docker`, `app_port: 8000`).
|
| 10 |
+
|
| 11 |
+
1. Create a free account at https://huggingface.co.
|
| 12 |
+
2. **New β Space**: choose **Docker** SDK (blank template), name it, set visibility
|
| 13 |
+
(Public = your boss can open the link with no login).
|
| 14 |
+
3. Push this repo to the Space's git remote (replace `<user>`/`<space>`):
|
| 15 |
+
```bash
|
| 16 |
+
git remote add space https://huggingface.co/spaces/<user>/<space>
|
| 17 |
+
git push space main
|
| 18 |
+
```
|
| 19 |
+
(Authenticate with an HF access token from https://huggingface.co/settings/tokens
|
| 20 |
+
β username = your HF name, password = the token.)
|
| 21 |
+
4. In the Space β **Settings β Variables and secrets** β add a **secret**
|
| 22 |
+
`GEMINI_API_KEY` = your paid key. (The model names default in code; no need to set
|
| 23 |
+
them.)
|
| 24 |
+
5. The Space builds (~3β5 min) and serves at `https://<user>-<space>.hf.space`.
|
| 25 |
+
|
| 26 |
+
**Free-tier caveat:** storage is **ephemeral** β projects/captures/uploads reset when
|
| 27 |
+
the Space rebuilds or is restarted (fine for a demo; data is intact during a session).
|
| 28 |
+
The Space sleeps after long inactivity and wakes on the next visit. Gemini is still
|
| 29 |
+
billed per comparison.
|
| 30 |
+
|
| 31 |
+
## Option B β Render (persistent, paid)
|
| 32 |
+
|
| 33 |
+
Deploys via the `render.yaml` blueprint as one web service with a **persistent disk**
|
| 34 |
+
(projects, captures, and uploaded images survive restarts and redeploys).
|
| 35 |
|
| 36 |
## One-time setup
|
| 37 |
|
Dockerfile
CHANGED
|
@@ -19,9 +19,11 @@ COPY demo1-physical-cad/backend/ ./
|
|
| 19 |
# built SPA -> ./static (served by app.py when present)
|
| 20 |
COPY --from=frontend /fe/dist ./static
|
| 21 |
|
| 22 |
-
# uploads + SQLite live here; mount a persistent disk at /data in the cloud
|
|
|
|
|
|
|
| 23 |
ENV LIVE_DATA_DIR=/data
|
| 24 |
-
RUN mkdir -p /data
|
| 25 |
|
| 26 |
EXPOSE 8000
|
| 27 |
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-8000}"]
|
|
|
|
| 19 |
# built SPA -> ./static (served by app.py when present)
|
| 20 |
COPY --from=frontend /fe/dist ./static
|
| 21 |
|
| 22 |
+
# uploads + SQLite live here; mount a persistent disk at /data in the cloud.
|
| 23 |
+
# world-writable so it works whether the host runs the container as root or a
|
| 24 |
+
# non-root user (e.g. Hugging Face Spaces).
|
| 25 |
ENV LIVE_DATA_DIR=/data
|
| 26 |
+
RUN mkdir -p /data && chmod 777 /data
|
| 27 |
|
| 28 |
EXPOSE 8000
|
| 29 |
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-8000}"]
|
README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# DevisionX β Site Progress Tracking (Physical β CAD)
|
| 2 |
|
| 3 |
An on-premise tool that tracks **construction progress** by comparing site photos
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: DevisionX Progress Tracking
|
| 3 |
+
emoji: ποΈ
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: gray
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 8000
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
<!-- The block above configures Hugging Face Spaces (Docker SDK). It is ignored by
|
| 12 |
+
GitHub except as a small metadata table. See DEPLOY.md for deploy steps. -->
|
| 13 |
+
|
| 14 |
# DevisionX β Site Progress Tracking (Physical β CAD)
|
| 15 |
|
| 16 |
An on-premise tool that tracks **construction progress** by comparing site photos
|