zybrai-ml / README.md
zybrAI's picture
Upload 4 files
064b842 verified
|
Raw
History Blame Contribute Delete
1.55 kB
---
title: zybrAI ML Inference
emoji: 🛡️
colorFrom: purple
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---
# zybrAI ML Inference Space
Free CPU host for zybrAI's two ML classifiers (DeBERTa prompt-injection +
toxic-RoBERTa), exposing them in the HF Inference API request/response shape so
the zybrAI backend can call this Space directly.
## Deploy (one-time, ~10 min)
1. Go to https://huggingface.co/new-space
2. Name it e.g. `zybrai-ml`, **Space SDK = Docker**, Hardware = **CPU basic (free)**, visibility = Public (or Private + secret below).
3. Upload the three files from this folder: `app.py`, `requirements.txt`, `Dockerfile` (and this README).
4. The Space builds automatically. When it shows **Running**, note its URL:
`https://<your-username>-zybrai-ml.hf.space`
5. Test it: open `https://<your-username>-zybrai-ml.hf.space/` — it should return `{"status":"ok", ...}`.
## Point zybrAI at it
On the zybrAI **backend** (Render env vars, and locally for testing):
```
ML_MODE = api
HF_API_BASE = https://<your-username>-zybrai-ml.hf.space
HF_API_KEY = zybrai # any value; must match SPACE_SECRET if you set one
```
Optional protection: set a Space **Secret** `SPACE_SECRET=<something>` and use the
same value as `HF_API_KEY` on the backend, so only zybrAI can use your Space.
## Note
Free CPU Spaces sleep after inactivity and cold-start on the next request
(~10–30s for the first call, fast after). Fine for a demo; upgrade to a paid
Space (always-on) later if you need consistent low latency.