Quick Start Guide
Local Development
- Install dependencies:
pip install -r requirements.txt
- Set environment variable:
# Windows PowerShell
$env:MONGODB_URI="mongodb://expenseuser:Kem_6o%3F%[email protected]:27017/expense?authSource=admin"
# Linux/Mac
export MONGODB_URI="mongodb://expenseuser:Kem_6o%3F%[email protected]:27017/expense?authSource=admin"
- Run the application:
uvicorn app.main:app --reload
- Access the API:
- API: http://localhost:8000
- Docs: http://localhost:8000/docs
- Health: http://localhost:8000/health
Test the Smart Budget Recommendation
- Create some sample expenses:
curl -X POST "http://localhost:8000/expenses" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user123",
"amount": 3800,
"category": "Groceries",
"description": "Monthly groceries",
"date": "2024-01-15T00:00:00",
"type": "expense"
}'
- Get recommendations:
curl "http://localhost:8000/recommendations/user123?month=2&year=2024"
Expected response:
[
{
"category": "Groceries",
"average_expense": 3800.0,
"recommended_budget": 4000.0,
"reason": "Your average monthly grocery expense is Rs.3,800. We suggest setting your budget to Rs.4,000 for next month (includes a 5% buffer for variability).",
"confidence": 0.85
}
]
Docker Deployment
- Build the image:
docker build -t smart-budget-recommendation .
- Run the container:
docker run -p 8000:8000 -e MONGODB_URI="your_mongodb_uri" smart-budget-recommendation
Hugging Face Deployment
See HUGGINGFACE_DEPLOYMENT.md for detailed instructions.
Quick steps:
- Create a new Docker Space on Hugging Face
- Add
MONGODB_URIas a secret - Upload all files
- Wait for automatic build and deployment