LuckmanShaik/AP_MSME_Backend
0
AP MSME Chatbot API
FastAPI backend for the AP MSME ONE Portal chatbot. Deployed on Hugging Face Spaces with Docker.
Endpoints
GET /health— pipeline readinessPOST /auth/request-otp— send OTP to a 10-digit mobile (demo OTP:123456)POST /auth/verify-otp— verify OTP and receive bearer tokenPOST /chat— main RAG chat endpoint (requiresAuthorization: Bearer <token>)POST /speech/stt— speech-to-text (multipart audio upload)POST /speech/tts— text-to-speech (returns audio/wav or audio/mpeg)GET /docs— Swagger UI
Secrets (HF Space Settings → Variables and secrets)
The Docker build only installs dependencies. You must add runtime secrets on the Space (Settings → Variables and secrets). Copy values from your local .env in the main project.
If startup fails with your-cluster.zillizcloud.com, MILVUS_URI / MILVUS_TOKEN were not set on the Space.
Local run
pip install -r requirements.txt
cp .env.example .env # fill in secrets
python run.pyDocker
requirements.txt is pinned for fast HF builds (CPU PyTorch, no optimum/CUDA wheels). The Dockerfile installs torch from the PyTorch CPU index before other deps.
docker build -t ap-msme-backend .
docker run -p 7860:7860 --env-file .env ap-msme-backendWindows local dev (Python 3.13 ONNX embeddings only):
pip install -r requirements.txt
pip install optimum[onnxruntime]==1.17.1 onnxruntime==1.23.2BM25 corpus (optional)
Place output/clean_chunks.json in the repo for keyword search. Vector search works without it.
