This guide will help you test both APIs before deploying to Vercel.
-
Start the server:
- Double-click
start_vercel_api.bat - OR run:
python api/vercel_index.py
- Double-click
-
Open the frontend:
- Open
index.htmlin your browser - The URL should be:
file:///C:/Users/rupga/OneDrive/Desktop/8/Bajaj_Project/index.html
- Open
-
Test the features:
- ✅ Without PDF: Click sample queries and submit (uses default policies)
- ✅ With PDF: Upload a policy PDF, then submit queries
- ✅ Check results: Verify APPROVED/REJECTED decisions
-
Stop the Vercel API (Press Ctrl+C in the command window)
-
Start the original server:
- Double-click
start_original_api.bat - OR run:
python api/index.py
- Double-click
-
Test with the same frontend:
- Refresh the browser page
- Test the same features
-
Keep one API running (either one)
-
Open a new terminal and run:
python test_apis.py
-
Follow the prompts to test each API
- Work WITHOUT any database
- Process PDFs in memory
- Handle queries with default policies
- Return proper JSON responses
- Show confidence scores and classifications
- Have all the same features
- Work with uploaded PDFs
- Process complex queries
Query: "25F with 2 years policy, need IVF treatment"
Expected: REJECTED (Standard policy doesn't cover IVF)
1. Upload a policy PDF
2. Query: "Is cardiac surgery covered?"
Expected: Decision based on PDF content
- "45M requiring cardiac surgery" → Should detect cardiac procedure
- "30F pregnant, maternity benefits?" → Should detect maternity
- "Emergency treatment coverage" → Should detect emergency
GET http://localhost:5000/health
Should return:
- Status: healthy
- Capabilities list
- Message
POST http://localhost:5000/query
Body: {
"query": "Your question here",
"session_id": "optional_if_pdf_uploaded"
}
POST http://localhost:5000/upload
Body: Form-data with PDF file
Your project is ready for deployment when:
- ✅ Health check returns "healthy"
- ✅ Queries work without PDF upload
- ✅ PDF upload processes successfully
- ✅ Queries return proper decisions (APPROVED/REJECTED)
- ✅ Confidence scores are shown
- ✅ Frontend displays results correctly
If all tests pass:
-
Install Vercel CLI:
npm install -g vercel
-
Deploy:
vercel
-
Follow prompts and your app will be live!
Solution: Make sure the API server is running
Solution: Install dependencies: pip install -r requirements.txt
Solution: Install: pip install pdfplumber PyPDF2
Solution: Check if API is running on port 5000
- Vercel API starts successfully
- Health endpoint works
- Query without PDF works
- PDF upload works
- Query with PDF works
- Frontend displays results
- Confidence scores shown
- Decision classifications correct
- Original API also works
- Automated tests pass
- Test locally first - Always test before deploying
- Check console - Browser console shows errors
- Use test script -
python test_apis.pyfor automated testing - Test both APIs - Ensure both work before choosing one
- Check logs - Server logs show processing details
Once everything works locally, you're ready to deploy to Vercel! 🎉