Prj2 / QUICK_START.md
iitmbs24f's picture
Upload 37 files
2f95553 verified
# Quick Start Guide
## 1. Install Dependencies
```bash
pip install -r requirements.txt
playwright install chromium
```
## 2. Set Environment Variables
### Option A: Use Setup Scripts (Recommended)
**Windows:**
```powershell
.\setup_env.ps1
```
**Linux/Mac:**
```bash
source setup_env.sh
```
### Option B: Manual Setup
**Windows PowerShell:**
```powershell
$env:QUIZ_SECRET = "your_secret_here"
$env:OPENAI_API_KEY = "sk-your-key-here" # Optional
```
**Linux/Mac:**
```bash
export QUIZ_SECRET="your_secret_here"
export OPENAI_API_KEY="sk-your-key-here" # Optional
```
### Option C: Use .env File
Create `.env` file:
```env
QUIZ_SECRET=your_secret_here
OPENAI_API_KEY=sk-your-key-here
```
## 3. Verify Setup
```bash
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
```bash
python -m app.main
```
Or:
```bash
uvicorn app.main:app --host 0.0.0.0 --port 8000
```
## 5. Test the API
**Health Check:**
```bash
curl http://localhost:8000/health
```
**Test Quiz Solving:**
```bash
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=8001` then restart
## Next Steps
- See [ENV_SETUP.md](ENV_SETUP.md) for detailed environment setup
- See [README.md](README.md) for full documentation
- Deploy to Hugging Face Spaces (see README.md)