# HF_Space_API (FastAPI + Docker) This Space exposes a **REST API** for document processing (summarize, embed, search, process PDFs). It is designed to **wrap your existing project** with minimal changes. ## How to use 1. Create a new **Hugging Face Space** → **Docker** template. 2. Push this folder to that Space (or upload as a ZIP and use the Space UI). 3. Set Space **Hardware** (e.g., T4 or A10G for GPU) and add **Space secrets** if needed: - `HF_TOKEN` (optional, for private models) - `API_SECRET` (optional, simple bearer auth) 4. Wire your own modules inside `app.py` (see TODO markers). ## Endpoints - `GET /health` - `POST /embed` — JSON: `{ "texts": ["..."] }` - `POST /summarize` — JSON: `{ "text": "..." }` - `POST /search` — JSON: `{ "query": "...", "k": 5 }` (dummy store until you wire your FAISS index) - `POST /process_pdf` — multipart/form-data: `file=@doc.pdf` ## Notes - Default uses `faiss-cpu`. On GPU Space you may switch to `faiss-gpu` in `requirements.txt`. - Avoid committing local cached models into git. Publish models to the Hub and **download at startup**.