Lung-Cancer-AI-Advisor / QUICK_DEPLOY.md
moazx's picture
Update .env.example with OpenAI and LangSmith configuration, modify app.py to dynamically set the port for deployment, enhance CORS middleware to support additional local development origins, and improve document retrieval settings for more comprehensive context in responses.
0a5dcf9
|
raw
history blame
2.26 kB
# Quick Deployment Guide - Hugging Face
## πŸš€ Deploy in 5 Steps
### Step 1: Create Hugging Face Space
1. Go to https://huggingface.co/spaces
2. Click "Create new Space"
3. Settings:
- Name: `moazx-api`
- SDK: **Docker**
- Hardware: CPU Basic (minimum)
### Step 2: Set Environment Variables
In Space Settings β†’ Secrets, add:
```
OPENAI_API_KEY=sk-...your-key...
GITHUB_TOKEN=ghp_...your-token...
GITHUB_REPO=username/repo-name
GITHUB_BRANCH=main
PORT=7860
```
### Step 3: Push Code
```bash
# Clone your Space
git clone https://huggingface.co/spaces/YOUR_USERNAME/moazx-api
cd moazx-api
# Copy all files from backend folder
cp -r /path/to/backend/* .
# Commit and push
git add .
git commit -m "Deploy Lung Cancer Clinical Decision Support System"
git push
```
### Step 4: Wait for Build
- Watch the build logs in your Space
- Wait for "Running" status (30-60 seconds)
### Step 5: Test
```bash
# Test health endpoint
curl https://YOUR_USERNAME-moazx-api.hf.space/health
# Visit API docs
open https://YOUR_USERNAME-moazx-api.hf.space/docs
```
## βœ… Verification Checklist
- [ ] Space is running (green status)
- [ ] `/health` returns `{"status": "healthy"}`
- [ ] `/docs` shows API documentation
- [ ] Can login with admin/admin123
- [ ] Can ask a test question
- [ ] Streaming responses work
- [ ] Citations appear in answers
## πŸ”§ Quick Fixes
### Build Failed?
- Check Dockerfile syntax
- Verify all files are committed
- Check Space logs for errors
### API Not Responding?
- Verify OPENAI_API_KEY is set
- Check Space logs
- Restart the Space
### Frontend Can't Connect?
- Update `frontend/script.js` with your Space URL:
```javascript
this.apiBase = 'https://YOUR_USERNAME-moazx-api.hf.space';
```
## πŸ“± Access Your Deployment
- **API**: `https://YOUR_USERNAME-moazx-api.hf.space`
- **Docs**: `https://YOUR_USERNAME-moazx-api.hf.space/docs`
- **Health**: `https://YOUR_USERNAME-moazx-api.hf.space/health`
## πŸ” Default Credentials
- Username: `admin`
- Password: `admin123`
**⚠️ Change these in production!**
## πŸ“š Full Documentation
- Detailed guide: `DEPLOYMENT.md`
- Complete summary: `DEPLOYMENT_SUMMARY.md`
- README: `README.md`
---
**Need Help?** Check the full deployment guide in `DEPLOYMENT.md`