Spaces:
Sleeping
Sleeping
File size: 2,556 Bytes
b4971bd |
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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# β‘ Quick Start: Cerebras Setup
## π― **What You Need to Do RIGHT NOW**
### **Step 1: Add Your API Key** (2 minutes)
You mentioned you already have a Cerebras API key. Let's add it!
**Edit the .env file**:
```bash
cd "/Users/niro/Documents/SL Clinical Assistant"
nano .env
```
Replace `<YOUR_CEREBRAS_API_KEY_HERE>` with your actual Cerebras API key.
**It should look like**:
```
CEREBRAS_API_KEY=csk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
Save and exit (Ctrl+X, then Y, then Enter).
---
### **Step 2: Install Cerebras SDK** (1 minute)
```bash
pip install cerebras-cloud-sdk
```
---
### **Step 3: Test Locally** (2 minutes)
```bash
# Make sure you're in the right directory
cd "/Users/niro/Documents/SL Clinical Assistant"
# Run the app
python app.py
```
**Expected output**:
```
π₯ Initializing VedaMD Enhanced for Hugging Face Spaces...
β
Cerebras API connection successful
β
Enhanced Medical RAG system ready!
Running on local URL: http://127.0.0.1:7860
```
Open http://localhost:7860 in your browser.
---
### **Step 4: Test Query** (1 minute)
In the chat interface, type:
```
What is preeclampsia?
```
**You should see**:
- β‘ Response in **< 3 seconds** (much faster than Groq!)
- Medical sources/citations
- Verification status
---
### **Step 5: Deploy to HF Spaces** (5 minutes)
Once local testing works:
1. **Add API key to HF Spaces**:
- Go to your Space Settings
- Repository secrets β Add secret
- Name: `CEREBRAS_API_KEY`
- Value: Your Cerebras API key
2. **Push code**:
```bash
git add .
git commit -m "feat: Migrate to Cerebras for ultra-fast inference"
git push origin main
```
3. **Watch logs** in HF Spaces for successful deployment
---
## π Done!
**Total time**: 10-15 minutes
Your app is now:
- β‘ **7x faster** (2000+ tps vs 280 tps)
- π° **FREE** (no more API costs!)
- π **Production-ready**
---
## π **If Something Goes Wrong**
### Error: "CEREBRAS_API_KEY not found"
```bash
# Check if key is set
cat .env
# Make sure it says:
CEREBRAS_API_KEY=csk-...
```
### Error: "No module named 'cerebras'"
```bash
pip install cerebras-cloud-sdk
```
### Error: "Invalid API key"
- Double-check your key at https://cloud.cerebras.ai
- Make sure it starts with `csk-`
- No spaces or quotes in .env file
---
## π **More Help**
- **Full guide**: See [CEREBRAS_MIGRATION_GUIDE.md](CEREBRAS_MIGRATION_GUIDE.md)
- **Deployment**: See [DEPLOYMENT.md](DEPLOYMENT.md)
- **Security**: See [SECURITY_SETUP.md](SECURITY_SETUP.md)
---
**Ready? Let's go!** π
|