--- title: Hannah-Pilot-Interface duplicate_from: null sdk: docker app_port: 7860 --- # Hannah Pilot Interface (Docker Space) This HuggingFace Space serves a FastAPI backend for the Hannah web UI. ## ✅ Endpoints - `GET /api/models` – lists available `.gguf` models in the repo - `GET /api/status` – lightweight health/status (RAM + CPU) - `POST /api/gen_title` – generates a short chat title - `POST /api/chat` – **streams NDJSON** responses (`application/x-ndjson`) ## Frontend Setup In your HTML frontend, set: ```js const API_BASE = "https://fugthchat-hannah-pilot-interface.hf.space"; ``` Your frontend should call: - `POST ${API_BASE}/api/chat` - `GET ${API_BASE}/api/models` - `GET ${API_BASE}/api/status` ## Models Upload your model files into the Space repo root: - `qwen2.5-0.5b-instruct-q2_k.gguf` (Light) - `qwen2.5-0.5b-instruct-q4_k_m.gguf` (Heavy) The backend auto-detects all `*.gguf` files. ## Avoiding Build Loops This Space uses: - Docker listening on `0.0.0.0:7860` - `app_port: 7860` in the README header If your Space keeps restarting: 1. Confirm the app listens on port `7860`. 2. Confirm `CMD` runs `uvicorn app:app --host 0.0.0.0 --port 7860`. 3. Check the Space logs for dependency install failures. ## Notes - This is CPU-friendly config (`n_threads=2`) for HuggingFace free tier. - Response streaming is NDJSON (one JSON per line: `{ "text": "..." }`).