--- 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// 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.