AI-powered Ayurvedic Dosha prediction app using XGBoost + FastAPI + React. Discover your unique constitution and receive personalized wellness guidance.
| Resource | Link |
|---|---|
| 🚀 Live App | doshapredictor.vercel.app |
| 📓 Kaggle Notebook | classifier-model-for-dosha-assessment |
| 💻 GitHub Repository | csxark/Dosha-Predictor |
dosha-prediction-ai/
├── backend/
│ ├── main.py # FastAPI app + prediction engine
│ ├── model.pkl # Your trained XGBoost model ← PUT IT HERE
│ ├── requirements.txt
│ ├── Procfile # Railway deployment
│ └── .env.example
└── frontend/
├── src/
│ ├── components/
│ │ ├── Landing.jsx
│ │ ├── Assessment.jsx
│ │ ├── Predicting.jsx
│ │ ├── Results.jsx
│ │ └── Analytics.jsx
│ ├── data/questions.js
│ ├── lib/appwrite.js
│ ├── App.jsx
│ └── index.css
├── .env.example
└── vercel.json
Copy your model.pkl into backend/:
cp /path/to/model.pkl backend/model.pklcd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000Test it:
curl -X POST http://localhost:8000/predict \
-H "Content-Type: application/json" \
-d '{
"bodyFrame": "Thin and Lean",
"paceOfWork": "Fast",
"bodyEnergy": "Low",
"hungerPattern": "Skips Meals",
"hairType": "Dry",
"sleepPattern": "Light Sleeper",
"mentalActivity": "Restless",
"voiceQuality": "Fast",
"jointStructure": "Light",
"skinType": "Dry",
"bodyOdor": "Mild"
}'- Go to https://railway.app → New Project → Deploy from GitHub
- Set root directory to
backend/ - Add environment variable:
MODEL_PATH=model.pkl - Railway will auto-detect
Procfileand deploy - Note your Railway URL (e.g.
https://dosha-backend.up.railway.app)
Important: Your
model.pklmust be committed to the repo, or uploaded via Railway's volume storage.
- Go to https://cloud.appwrite.io → Create Project
- Create a Database → note the Database ID
- Create a Collection called
assessments→ note Collection ID - Add these attributes to the collection:
assessmentId→ String (255)timestamp→ String (64)predictedDosha→ String (32)confidence→ FloatsecondaryDosha→ String (32)answers→ String (4096)
- Set Collection permissions: Any can Create and Read (for anonymous storage)
cp .env.example .env.local
# Fill in your values in .env.local
npm install
npm run devVITE_API_URL=https://your-railway-backend.up.railway.app
VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=your_project_id
VITE_APPWRITE_DATABASE_ID=your_database_id
VITE_APPWRITE_COLLECTION_ID=your_collection_id
- Push frontend folder to GitHub
- Go to https://vercel.com → New Project → Import repo
- Set root directory to
frontend/ - Add all 5 environment variables in Vercel dashboard
- Deploy!
The backend uses label encoding (ordinal) for all features. The encoding maps in main.py must match your training preprocessing exactly.
If your model used one-hot encoding instead, update encode_input() in main.py:
def encode_input(data: AssessmentInput) -> pd.DataFrame:
row = {field: getattr(data, field) for field in FEATURE_ORDER}
df = pd.DataFrame([row])
df_encoded = pd.get_dummies(df)
# Align with training columns
training_cols = model.get_booster().feature_names
df_encoded = df_encoded.reindex(columns=training_cols, fill_value=0)
return df_encoded| Layer | Technology |
|---|---|
| Frontend | React + Vite + Tailwind CSS v4 |
| Animations | Framer Motion |
| Charts | Recharts |
| Backend | FastAPI + Uvicorn |
| ML Model | XGBoost via Joblib |
| Database | Appwrite Cloud |
| Deployment | Vercel (frontend) + Railway (backend) |
- No authentication — fully anonymous
- No PII collected — only answers + prediction stored
- Fallback mode — if model.pkl fails to load, a rule-based algorithm runs
- Fallback UI — if the API is down, a mock result is shown so the UI never breaks