DEV Community

Satyam Pawar
Satyam Pawar

Posted on

SpendWise AI: Building a Local AI-Powered Expense Tracker with Gemma 3 and Streamlit

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission 💸

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle.

What I Built

For Hacktoberfest 2026, I wanted to build something small, practical, and useful while getting some hands-on experience with open-weight AI models.

That's how I came up with SpendWise AI, a simple AI-powered expense tracker that lets users record their spending using everyday language.

Instead of manually entering each expense into a spreadsheet, users can simply type something like:

Today I spent Rs 150 on coffee, Rs 300 on Uber, and Rs 200 on lunch.

The application uses a locally running AI model to extract individual transactions, identify their amounts, and assign spending categories.

It then generates a dashboard displaying total spending, transaction count, average expense, and a category-wise spending chart.

Key Features

  • Natural Language Input: Add multiple expenses using a single sentence.
  • AI-Powered Categorization: Automatically identify items, amounts, and spending categories.
  • Expense Dashboard: View spending statistics and individual transactions.
  • Spending Visualization: Understand spending habits through category-wise charts.
  • CSV Export: Download expense records for future reference.
  • Local AI Processing: Run the AI model locally without relying on a paid cloud API.

Who Is It For?

SpendWise AI could be useful for students, freelancers, or individuals who want a quicker way to record everyday expenses.

With features like persistent storage, budgeting, and receipt scanning, it could eventually become a lightweight expense-management tool that users might be willing to pay for.

For now, it's a working prototype built primarily to learn and experiment with local AI.

Demo

Here's a short demonstration of SpendWise AI in action:

The demo shows how users can enter expenses in natural language and view the extracted transactions and spending dashboard.

Code

The complete source code is available on GitHub:

GitHub Repository: SpendWise AI

The repository includes the application source code, required Python dependencies, and instructions for running the project locally.

How I Built It

I built SpendWise AI using Python, Streamlit, Ollama, and Google's Gemma 3 (1B) open-weight language model.

Tech Stack

Technology Purpose
Python Core application logic
Streamlit User interface and dashboard
Ollama Running the AI model locally
Gemma 3 (1B) Extracting and categorizing expenses
Pydantic Validating structured AI responses
Pandas Processing transactions and generating summaries

How It Works

1. Taking User Input

I used Streamlit to create a simple interface where users can describe their expenses in natural language.

2. Processing Text with Gemma 3

When the user submits their expenses, Python sends the text to Gemma 3 through Ollama.

The model is instructed to identify individual purchases, amounts, and suitable categories.

3. Generating Structured Output

Instead of requesting a normal text response, I used Pydantic to define a structured output schema.

This helps the application receive expense information in a predictable JSON format.

For example:

{
  "expenses": [
    {
      "item": "Coffee",
      "amount": 150,
      "category": "Food"
    },
    {
      "item": "Uber",
      "amount": 300,
      "category": "Transport"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

4. Building the Dashboard

After validating the model's response, the application stores the extracted transactions in Streamlit session state.

Pandas handles the calculations for total spending, transaction count, average expense, and category-wise summaries.

Streamlit then displays the results using tables, metrics, and a bar chart.

5. Exporting Expenses

I also added a CSV download feature so users can export their transactions.

Challenges and Limitations

One of the interesting parts of this project was learning how to connect a locally running language model to a Python web application.

I also learned why structured outputs are useful when integrating LLMs into applications that expect specific data formats.

The current version has some limitations:

  • Expense records are stored only during the current Streamlit session.
  • The application currently assumes Indian rupees.
  • AI extraction and categorization can occasionally be inaccurate.
  • Receipt scanning and persistent storage are not implemented yet.

In the future, I'd like to add SQLite storage, receipt scanning, and monthly budget tracking.

Why Does Open Innovation Matter?

The main reason I chose Ollama and Gemma 3 was to explore how AI applications can work without depending on paid cloud-based APIs.

For SpendWise AI, local inference offers several benefits.

1. Privacy

Expense information can contain personal financial details. By running Gemma locally through Ollama, the application can process this information without sending it to an external AI inference service.

2. No Per-Request API Charges

After downloading the model, users can run inference on their own hardware without paying for individual API requests. There are still local computing and electricity costs, but no model API usage fees.

3. Offline Capability

Once the required software and model have been downloaded, the application can run without an internet connection.

4. Flexibility

Using a locally hosted model also gives developers more control over how the application works.

It becomes possible to experiment with different supported models, change prompts, and customize the extraction logic without depending entirely on a single proprietary AI provider.

For a small application like SpendWise AI, these advantages make open-weight models especially interesting.

Prize Categories

Best Use of Gemma

SpendWise AI uses Google's Gemma 3 (1B) model as the core of its expense extraction and categorization system, with inference handled locally through Ollama.

What I Learned

This project was a great introduction to building an application around a locally running AI model.

While working on SpendWise AI, I gained experience with:

  • Integrating local language models into Python applications.
  • Building interactive interfaces using Streamlit.
  • Working with structured JSON outputs and Pydantic.
  • Processing and visualizing data using Pandas.
  • Documenting a project and publishing it on GitHub.

SpendWise AI is still a small prototype, but building something that works from end to end was a valuable learning experience.

I'm looking forward to exploring more open-source AI projects and improving this one over time!

Thanks for reading! 🎃

Top comments (0)