Spaces:
Running
Running
| # 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` | |