VedaMD-Backend-v2 / QUICK_START_CEREBRAS.md
sniro23's picture
Production ready: Clean codebase + Cerebras + Automated pipeline
b4971bd

A newer version of the Gradio SDK is available: 6.0.0

Upgrade

⚑ 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:

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)

pip install cerebras-cloud-sdk

Step 3: Test Locally (2 minutes)

# 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:

    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"

# Check if key is set
cat .env

# Make sure it says:
CEREBRAS_API_KEY=csk-...

Error: "No module named 'cerebras'"

pip install cerebras-cloud-sdk

Error: "Invalid API key"


πŸ“– More Help


Ready? Let's go! πŸš€