Building a Local AI-Powered KPI Dashboard with Streamlit and Ollama

In this project, I built a sleek, brand-aligned business intelligence dashboard powered entirely by local AI β€” no API keys, no cloud dependencies. Just Python, Streamlit, and Ollama running smart and fast right on my machine.

AI Powered Dashboard
Click On Image

🎯 The Goal

Create a lightweight yet powerful app that lets users:

  • Upload or use built-in business KPI data
  • Visualize revenue, profit, and conversion trends
  • Generate AI-powered summaries and insights
  • Ask follow-up questions using natural language
  • Export clean PDF reports β€” charts included

πŸ”§ The Tech Stack

LayerTech
FrontendStreamlit (Python)
ChartsMatplotlib
AI EngineOllama + Mistral model
PDF ExportFPDF
Storagetempfile, CSV, session

🧱 What the App Does

πŸ“Š 1. Upload or Simulate Business Data

The app loads default revenue, expenses, leads, and client data β€” or allows the user to upload a custom CSV. It auto-generates calculated fields like:

  • Profit = Revenue - Expenses
  • Conversion Rate = Clients Γ· Leads

πŸ“ˆ 2. Visualize KPIs

Three clean, responsive charts are generated with Matplotlib:

  • Revenue vs. Expenses (Line Chart)
  • Monthly Profit (Bar Chart)
  • Conversion Rate (Line Chart)

🧠 3. Generate AI Summaries

Click a button and get a GPT-style summary of your data using Ollama + a locally-running Mistral model β€” no API required.

Summaries are cached in session_state, so they persist between interactions and don’t get overwritten by the chat module.


πŸ’¬ 4. Ask the Model Business Questions

Type in a natural language question like:

β€œWhat’s the trend in profit over the past 3 months?”

The app feeds both the KPI data and the question to Ollama and returns a contextual, AI-generated answer.


πŸ“„ 5. Export PDF Reports

Generate branded PDF reports including:

  • Title and summary section
  • Embedded KPI charts
  • Styled with your brand colors

πŸ“₯ 6. Download Raw Data

Export your data as a CSV at any time.


🧠 Why It’s Cool

  • Offline AI: Runs entirely on your machine with Ollama (tested with Mistral, Gemma, and Phi)
  • Customizable: Plug in any dataset or model
  • Scalable: Easy to repurpose for client reporting, SaaS, or internal BI tooling
  • Free and Private: No API usage, no cloud costs, no data leaving your machine

πŸš€ Next Steps

I’ll continue refining it by:

  • Adding markdown rendering in PDFs
  • Supporting advanced formatting (headings, lists)
  • Packaging it for internal use or monetization

Stay tuned β€” or reach out if you want help building something like this for your team.