Quick Start Guide
1. Install Dependencies
pip install -r requirements.txt
playwright install chromium
2. Set Environment Variables
Option A: Use Setup Scripts (Recommended)
Windows:
.\setup_env.ps1
Linux/Mac:
source setup_env.sh
Option B: Manual Setup
Windows PowerShell:
$env:QUIZ_SECRET = "your_secret_here"
$env:OPENAI_API_KEY = "sk-your-key-here" # Optional
Linux/Mac:
export QUIZ_SECRET="your_secret_here"
export OPENAI_API_KEY="sk-your-key-here" # Optional
Option C: Use .env File
Create .env file:
QUIZ_SECRET=your_secret_here
OPENAI_API_KEY=sk-your-key-here
3. Verify Setup
python check_env.py
You should see:
✓ QUIZ_SECRET: Set (xxxx...xxxx)
✓ OPENAI_API_KEY: Set (sk-...xxxx) [if set]
✓ Status: Ready to run
4. Start the Server
python -m app.main
Or:
uvicorn app.main:app --host 0.0.0.0 --port 8000
5. Test the API
Health Check:
curl http://localhost:8000/health
Test Quiz Solving:
curl -X POST http://localhost:8000/demo \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"secret": "your_secret_here",
"url": "https://example.com/quiz"
}'
Troubleshooting
"QUIZ_SECRET is NOT SET"
- Run the setup script again
- Or manually set:
export QUIZ_SECRET="your_secret"(Linux/Mac) - Or:
$env:QUIZ_SECRET = "your_secret"(Windows)
"Module not found"
- Run:
pip install -r requirements.txt
"Playwright browser not found"
- Run:
playwright install chromium
Server won't start
- Check if port 8000 is available
- Change port:
export PORT=8001then restart
Next Steps
- See ENV_SETUP.md for detailed environment setup
- See README.md for full documentation
- Deploy to Hugging Face Spaces (see README.md)