File size: 2,079 Bytes
6754826 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ---
title: Anam Code
emoji: π§ββοΈ
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---
# Anam avatar demo β Hugging Face Spaces deploy package
Self-contained copy of the `anam` (FastAPI backend + frontend) and `agent` (LLM +
local RAG server) apps, stripped of local caches/secrets, ready to push to a
Hugging Face Space.
## What's in here
- `Dockerfile`, `start.sh` β build the image and run both servers (`agent` internally
on port 8005, `anam` publicly on port 7860 β the port Hugging Face Spaces expects).
- `anam/` β the avatar app (frontend + backend in one FastAPI process).
- `agent/` β the LLM proxy used by `anam`'s "Agent LLM" mode.
- `scripts/create_vector_store.py` β one-off script to create the persistent OpenAI
vector store used by anam's local RAG (upload documents β search).
## Deploy steps
### 1. Create the vector store (once)
```bash
pip install openai
OPENAI_API_KEY=sk-... python scripts/create_vector_store.py
```
Copy the printed `vs_...` id β you'll need it in step 4.
### 2. Create the Space
On huggingface.co β New Space β SDK: **Docker** β Hardware: **CPU basic (free)**.
### 3. Push this folder to it
```bash
git init
git add .
git commit -m "Initial deploy"
git remote add hf https://huggingface.co/spaces/<your-username>/<space-name>
git push hf main
```
### 4. Add repository secrets
Space β Settings β Variables and secrets β New secret:
| Name | Value |
|---|---|
| `ANAM_API_KEY` | your Anam API key |
| `OPENAI_API_KEY` | your OpenAI API key |
| `OPENAI_VECTOR_STORE_ID` | the `vs_...` id from step 1 |
### 5. Done
The Space rebuilds automatically once secrets are set. Open the Space URL to verify.
## Known limitation
`anam/rag_state.json` (native Anam-hosted RAG ids) and `anam/telemetry_data.json`
reset on every Space rebuild/restart β the free tier has no persistent disk. The
OpenAI-vector-store-backed local RAG (documents you upload via the UI) is not
affected by this β it survives restarts as long as `OPENAI_VECTOR_STORE_ID` stays
the same.
|