Skip to content
Back to skills

Inference Backend

ASecurity

Flask inference backend on Hugging Face Spaces: job lifecycle, endpoints, telemetry, model loading, limits, proxy routes.

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 19, 2026
developmentnextjsflaskapibackend

Works with

  • api

Security analysis

A100/100

Scanned September 19, 2026

npx -y skills add Adilmunawar/ZD-claude-plugin --skill inference-backend --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Inference Backend?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Inference Backend
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adilmunawar-inference-backend/badge)](https://www.skillsdirectory.com/skills/adilmunawar-inference-backend)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: inference-backend
paths: ["hf_space_backend/**", "src/app/api/predict/**", "src/app/api/job_*/**"]
description: Flask inference backend on Hugging Face Spaces: job lifecycle, endpoints, telemetry, model loading, limits, proxy routes.
---

Endpoints: `GET /health`, `GET /api/telemetry`, `POST /predict` (multipart zip of parcels + `model_type`, `target_year`) → `{ job_id }`, `GET /job_status/<id>` → `{ status, progress, log, summary, error }`, `GET /job_download/<id>` → GeoJSON, `GET /job_timeseries/<id>/<parcel_uid>`.

Job lifecycle: `queued → running (progress 0–100) → done | failed`; `ThreadPoolExecutor(MAX_WORKERS=4)`, `waiting_jobs` list under a lock, temp dir per job, `gc.collect()` in `finally`. Status kept in memory — a Space restart loses jobs; the UI must handle 404 on `job_status` by offering re-submit.

Backend rules
- Auth to the Space is a Bearer `HF_TOKEN` added by the Next.js proxy; the browser never holds it. Proxy streams the multipart body (`duplex: 'half'`) to avoid buffering.
- Earth Engine in the backend authenticates from a base64 or file key in Space secrets (`EE_BASE64_KEY`); normalise `private_key` newlines.
- Models via `hf_hub_download` at startup, cached in the container; log the model version in every job summary.
- Post-processing (land-use rules, temporal continuity, seasonal plan) runs after prediction; document each rule change in the summary.
- Memory: free-tier Spaces are ~16 GB RAM; process parcels in chunks of `CHUNK_SIZE=400` and never load all imagery. Telemetry endpoint exposes CPU/RAM/network for the dashboard's telemetry page.
- Health: `/health` must return within 1 s without touching EE.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…