anam_code / README.md
Vaibhav Kathait
Initial deploy
6754826
|
Raw History Blame Contribute Delete
2.08 kB
---
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.