Spaces:
Sleeping
Sleeping
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: | |
```env | |
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 | |
1. Install dependencies: | |
```bash | |
pip install -r requirements.txt | |
``` | |
2. Run the development server: | |
```bash | |
uvicorn app.main:app --reload --host 0.0.0.0 --port 7860 | |
``` | |
## Docker Deployment | |
Build and run with Docker: | |
```bash | |
docker build -t medical-chatbot . | |
docker run -p 7860:7860 --env-file .env medical-chatbot | |
``` | |
## API Endpoints | |
- `GET /health`: Health check endpoint | |
- `POST /chat`: Chat endpoint | |
```json | |
{ | |
"question": "What are the symptoms of diabetes?", | |
"context": "Optional medical context" | |
} | |
``` | |
## Production Deployment | |
For Hugging Face Spaces: | |
1. Set repository secrets in Space settings | |
2. Deploy using the provided Dockerfile | |
3. Ensure model weights are properly configured |