metadata
title: Medical Chatbot API
emoji: π₯
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: '1.0'
app_file: app/main.py
pinned: false
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Medical Chatbot API
A FastAPI-based medical chatbot API powered by LangChain and custom models.
Configuration
Environment Variables
Create a .env
file with the following variables:
QDRANT_URL=your_qdrant_url
QDRANT_API_KEY=your_qdrant_api_key
HF_TOKEN=your_huggingface_token
Model Configuration
The application expects the following model structure:
models/
βββ embeddings/
βββ llm/
Dependencies
Key dependencies include:
- LangChain ecosystem
- Qdrant for vector storage
- Unsloth for optimized model loading
- FastAPI for the web framework
Development Setup
- Install dependencies:
pip install -r requirements.txt
- Run the development server:
uvicorn app.main:app --reload --host 0.0.0.0 --port 7860
Docker Deployment
Build and run with Docker:
docker build -t medical-chatbot .
docker run -p 7860:7860 --env-file .env medical-chatbot
API Endpoints
GET /health
: Health check endpointPOST /chat
: Chat endpoint{ "question": "What are the symptoms of diabetes?", "context": "Optional medical context" }
Production Deployment
For Hugging Face Spaces:
- Set repository secrets in Space settings
- Deploy using the provided Dockerfile
- Ensure model weights are properly configured