Delete Agent.md with huggingface_hub
Browse files
Agent.md
DELETED
|
@@ -1,137 +0,0 @@
|
|
| 1 |
-
## 1. Deployment Configuration
|
| 2 |
-
|
| 3 |
-
### Target Space
|
| 4 |
-
- **Profile:** `Leon4gr45`
|
| 5 |
-
- **Space:** `openweb`
|
| 6 |
-
- **Full Identifier:** `Leon4gr45/openweb`
|
| 7 |
-
- **Frontend Port:** `7860` (mandatory for all Hugging Face Spaces)
|
| 8 |
-
|
| 9 |
-
### Deployment Method
|
| 10 |
-
Choose the correct SDK based on the app type based on the codebase language:
|
| 11 |
-
|
| 12 |
-
- **Gradio SDK** — for Gradio applications
|
| 13 |
-
- **Streamlit SDK** — for Streamlit applications
|
| 14 |
-
- **Docker SDK** — for all other applications (recommended default for flexibility)
|
| 15 |
-
|
| 16 |
-
### HF Token
|
| 17 |
-
- The environment variable **`hf_your_token_here` will always be provided at execution time**.
|
| 18 |
-
- Never hardcode the token. Always read it from the environment.
|
| 19 |
-
- All monitoring and log‑streaming commands rely on `hf_your_token_here`.
|
| 20 |
-
|
| 21 |
-
### Required Files
|
| 22 |
-
- `Dockerfile` (or `app.py` for Gradio/Streamlit SDKs)
|
| 23 |
-
- `README.md` with Hugging Face YAML frontmatter:
|
| 24 |
-
```yaml
|
| 25 |
-
---
|
| 26 |
-
title: <APP NAME>
|
| 27 |
-
sdk: docker | gradio | streamlit
|
| 28 |
-
app_port: 7860
|
| 29 |
-
---
|
| 30 |
-
```
|
| 31 |
-
- `.hfignore` to exclude unnecessary files
|
| 32 |
-
- This `Agent.md` file (must be committed before deployment)
|
| 33 |
-
|
| 34 |
-
---
|
| 35 |
-
|
| 36 |
-
## 2. API Exposure and Documentation
|
| 37 |
-
|
| 38 |
-
### Mandatory Endpoints
|
| 39 |
-
Every deployment **must** expose:
|
| 40 |
-
|
| 41 |
-
- **`/health`**
|
| 42 |
-
- Returns HTTP 200 when the app is ready.
|
| 43 |
-
- Required for Hugging Face to transition the Space from *starting* → *running*.
|
| 44 |
-
|
| 45 |
-
- **`/api-docs`**
|
| 46 |
-
- Documents **all** available API endpoints.
|
| 47 |
-
- Must be reachable at:
|
| 48 |
-
`https://HF_PROFILE-openweb.hf.space/api-docs`
|
| 49 |
-
|
| 50 |
-
### Functional Endpoints
|
| 51 |
-
Document each endpoint here. For every endpoint, include:
|
| 52 |
-
|
| 53 |
-
- **Method:** GET/POST/PUT/DELETE
|
| 54 |
-
- **Path:** `/predict`, `/generate`, `/upload`, etc.
|
| 55 |
-
- **Purpose:** What the endpoint does
|
| 56 |
-
- **Request Example:** JSON or query parameters
|
| 57 |
-
- **Response Example:** JSON schema or example payload
|
| 58 |
-
|
| 59 |
-
### /api/stats
|
| 60 |
-
- Method: GET
|
| 61 |
-
- Purpose: Get index statistics and manifest details
|
| 62 |
-
- Request: {}
|
| 63 |
-
- Response: {"views_built": {}, "limitations": "...", "dims": [768], "views": ["text"], "view_descriptions": {}, "storage": [], "total_duration_s": 0}
|
| 64 |
-
|
| 65 |
-
### /api/videos
|
| 66 |
-
- Method: GET
|
| 67 |
-
- Purpose: List all indexed videos
|
| 68 |
-
- Request: {}
|
| 69 |
-
- Response: [{"video_id": "xyz", "title": "...", "duration": 120}]
|
| 70 |
-
|
| 71 |
-
### /api/videos/{video_id}
|
| 72 |
-
- Method: GET
|
| 73 |
-
- Purpose: Get details, segments and transcripts for a specific video
|
| 74 |
-
- Request: video_id path param
|
| 75 |
-
- Response: {"video_id": "xyz", "title": "...", "duration": 120, "segments": [], "transcript": [], "transcripts": {}}
|
| 76 |
-
|
| 77 |
-
### /api/search
|
| 78 |
-
- Method: GET
|
| 79 |
-
- Purpose: Search across embedded segments
|
| 80 |
-
- Request: `?q=query&view=text&dim=768&k=10`
|
| 81 |
-
- Response: {"query": "...", "view": "...", "dim": 768, "hits": [], "timing": {}}
|
| 82 |
-
|
| 83 |
-
### /api/compare
|
| 84 |
-
- Method: GET
|
| 85 |
-
- Purpose: Compare MRL dims for a specific view
|
| 86 |
-
- Request: `?q=query&view=text&k=5`
|
| 87 |
-
- Response: {"query": "...", "view": "...", "k": 5, "columns": []}
|
| 88 |
-
|
| 89 |
-
### /api/compare-views
|
| 90 |
-
- Method: GET
|
| 91 |
-
- Purpose: Compare across views for a specific dim
|
| 92 |
-
- Request: `?q=query&dim=768&k=5`
|
| 93 |
-
- Response: {"query": "...", "dim": 768, "k": 5, "columns": []}
|
| 94 |
-
|
| 95 |
-
### /api/ask
|
| 96 |
-
- Method: POST
|
| 97 |
-
- Purpose: Ask a question based on retrieved clips
|
| 98 |
-
- Request: {"question": "...", "view": "text", "dim": 768, "k": 4, "use_video": true, "use_audio": false}
|
| 99 |
-
- Response: {"answer": "...", "clips": []}
|
| 100 |
-
|
| 101 |
-
### /api/answers
|
| 102 |
-
- Method: GET
|
| 103 |
-
- Purpose: List answer history
|
| 104 |
-
- Request: `?limit=50`
|
| 105 |
-
- Response: [{"question": "...", "answer": "...", "clips": []}]
|
| 106 |
-
|
| 107 |
-
### /api/experiments
|
| 108 |
-
- Method: GET
|
| 109 |
-
- Purpose: Get experiment results
|
| 110 |
-
- Request: `?transcripts=whisper` (optional)
|
| 111 |
-
- Response: {"variants": [], "per_query": []}
|
| 112 |
-
|
| 113 |
-
All endpoints listed here **must** appear in `/api-docs`.
|
| 114 |
-
|
| 115 |
-
---
|
| 116 |
-
|
| 117 |
-
## 3. Deployment Workflow
|
| 118 |
-
|
| 119 |
-
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
|
| 120 |
-
|
| 121 |
-
### Standard Deployment Command
|
| 122 |
-
After any code change, run:
|
| 123 |
-
|
| 124 |
-
```bash
|
| 125 |
-
hf upload Leon4gr45/openweb --repo-type=space
|
| 126 |
-
---
|
| 127 |
-
|
| 128 |
-
Scan build and run logs # Get build logs (SSE) curl -N
|
| 129 |
-
-H "Authorization: Bearer hf_your_token_here"
|
| 130 |
-
"https://huggingface.co/api/spaces/Leon4gr45/openweb/logs/build"
|
| 131 |
-
|
| 132 |
-
Get run logs (SSE) once the build logs succeed
|
| 133 |
-
curl -N
|
| 134 |
-
-H "Authorization: Bearer hf_your_token_here"
|
| 135 |
-
"https://huggingface.co/api/spaces/Leon4gr45/openweb/logs/run"
|
| 136 |
-
|
| 137 |
-
after 300 seconds to see if the deployment has been successful, and if not, fix the errors of deployment, and redeploy and monitor in a cycle until the space is running and reacts to the api endpoints you created.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|