File size: 2,260 Bytes
0a5dcf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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`