## 1. Deployment Configuration ### Target Space - **Profile:** `GraziePrego` - **Space:** `agent` - **Full Identifier:** `GraziePrego/agent` - **Frontend Port:** `7860` (mandatory for all Hugging Face Spaces) ### Deployment Method Choose the correct SDK based on the app type based on the codebase language: - **Gradio SDK** — for Gradio applications - **Streamlit SDK** — for Streamlit applications - **Docker SDK** — for all other applications (recommended default for flexibility) ### HF Token - The environment variable **`hf_tdYWGdkAgCjNRgshPwvOddOItzxSrhOeQ...` will always be provided at execution time**. - Never hardcode the token. Always read it from the environment. - All monitoring and log‑streaming commands rely on `hf_tdYWGdkAgCjNRgshPwvOddOItzxSrhOeQ...`. ### Required Files - `Dockerfile` (or `app.py` for Gradio/Streamlit SDKs) - `README.md` with Hugging Face YAML frontmatter: ```yaml --- title: agent sdk: docker app_port: 7860 --- ``` - `.hfignore` to exclude unnecessary files - This `Agent.md` file (must be committed before deployment) --- ## 2. API Exposure and Documentation ### Mandatory Endpoints Every deployment **must** expose: - **`/health`** - Returns HTTP 200 when the app is ready. - Required for Hugging Face to transition the Space from *starting* → *running*. - **`/api-docs`** - Documents **all** available API endpoints. - Must be reachable at: `https://GraziePrego-agent.hf.space/api-docs` ### Functional Endpoints Document each endpoint here. For every endpoint, include: - **Method:** GET/POST/PUT/DELETE - **Path:** `/predict`, `/generate`, `/upload`, etc. - **Purpose:** What the endpoint does - **Request Example:** JSON or query parameters - **Response Example:** JSON schema or example payload ### /health - Method: GET - Purpose: Returns HTTP 200 when the app is ready and provides health information. - Request: {} - Response: { "status": "ok", "version": "...", ... } ### /api-docs - Method: GET - Purpose: Documents all available API endpoints. - Request: {} - Response: { "endpoints": [...] } --- ## 3. Deployment Workflow Precondition: Use the huggingface hub cli hf to check that the space is empty of files nd delete any which are still in there and not belonging to the project to be uploaded ### Standard Deployment Command After any code change, run: ```bash hf upload GraziePrego/agent --repo-type=space ```