LogicGoInfotechSpaces's picture
Initial smart budget API
847392c
|
raw
history blame
1.87 kB

Quick Start Guide

Local Development

  1. Install dependencies:
pip install -r requirements.txt
  1. 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"
  1. Run the application:
uvicorn app.main:app --reload
  1. Access the API:

Test the Smart Budget Recommendation

  1. 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"
  }'
  1. 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

  1. Build the image:
docker build -t smart-budget-recommendation .
  1. 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:

  1. Create a new Docker Space on Hugging Face
  2. Add MONGODB_URI as a secret
  3. Upload all files
  4. Wait for automatic build and deployment