Ask a question. Get a dashboard. No SQL. No BI tools. Just insights.
InsightFlow-AI is a conversational AI data analytics tool that converts natural language questions into interactive dashboards - automatically generating SQL queries, charts, and business insights from any uploaded CSV dataset.
Upload your data β Ask a question β Instantly get visual analytics.
Built for hackathons and rapid data exploration using Google Gemini, Streamlit, Pandas, SQLite, and Plotly.
Example interaction:
User:
Show total views by category
System:
β Generates SQL
β Executes query on dataset
β Chooses best chart type
β Builds dashboard
β Generates AI insights
Follow-up queries work conversationally:
User: Show views by category
User: Only for 2024
System resolves to:
Show views by category for 2024
No manual filtering required.
| Feature | Description |
|---|---|
| π¬ Natural language queries | Ask questions about your dataset in plain English |
| π€ AI-generated SQL | Gemini converts questions into SQLite queries |
| π Smart chart selection | Automatically chooses bar, line, pie, or scatter |
| β‘ Interactive Plotly charts | Zoom, hover, inspect, export |
| π§ AI business insights | Gemini generates 3β5 bullet insights from results |
| π Conversational follow-ups | Context-aware query rewriting |
| π Upload any CSV | Works with arbitrary datasets |
| π‘ Dynamic example queries | AI suggests relevant questions for each dataset |
| π§ Schema-aware reasoning | Automatically extracts numeric/categorical columns |
User Query
β
βΌ
ββββββββββββββββββββββββ
β Followup Resolver β
β followup_resolver.py β
β (Gemini) β
ββββββββββββ¬ββββββββββββ
β Standalone query
βΌ
ββββββββββββββββββββββββ
β SQL Generator β
β sql_generator.py β
β (Gemini) β
ββββββββββββ¬ββββββββββββ
β SQL Query
βΌ
ββββββββββββββββββββββββ
β Query Executor β
β query_executor.py β
β SQLite + Pandas β
ββββββββββββ¬ββββββββββββ
β DataFrame
βΌ
ββββββββββββββββββββββββ
β Chart Selector β
β chart_selector.py β
β (Gemini reasoning) β
ββββββββββββ¬ββββββββββββ
β Chart type
βΌ
ββββββββββββββββββββββββ
β Chart Renderer β
β chart_renderer.py β
β Plotly builder β
ββββββββββββ¬ββββββββββββ
β
βββββββββββββββΊ AI Insights Generator
β insights_generator.py
β (Gemini)
βΌ
Streamlit UI
InsightFlow-AI/
β
βββ backend/
β βββ gemini_client.py
β βββ sql_generator.py
β βββ query_executor.py
β βββ chart_selector.py
β βββ chart_renderer.py
β βββ insights_generator.py
β βββ followup_resolver.py
β βββ example_generator.py
β
βββ frontend/
β βββ app.py
β βββ style.css
β
βββ utils/
β βββ schema_loader.py
β βββ css_loader.py
β
βββ prompts/
β βββ sql_prompt.txt
β βββ chart_prompt.txt
β βββ insight_prompt.txt
β βββ followup_prompt.txt
β βββ examples_prompt.txt
β
βββ requirements.txt
βββ .env
βββ README.md
- Python 3.10+
- Google Gemini API key
Get your key here:
https://aistudio.google.com/app/api-keys
git clone https://github.com/openvaibhav/InsightFlow-AI.git
cd InsightFlow-AI
python -m venv venv
# Bash:
source venv/bin/activate
# Fish:
source venv/bin/activate.fish
# Windows:
# venv\Scripts\activate
pip install -r requirements.txtCreate a .env file:
GEMINI_API_KEY=your_api_key_here
streamlit run frontend/app.py
Then open:
http://localhost:8501
1οΈβ£ Upload a CSV dataset
2οΈβ£ Ask a question about the data
3οΈβ£ The system automatically:
- Generates SQL
- Runs query
- Picks chart
- Renders dashboard
- Produces insights
4οΈβ£ Ask follow-up questions conversationally
Works for many datasets.
Examples:
Show total views by category
Which category has the highest engagement
Top 10 videos by views
Compare views and likes
Show monthly views trend
Which region has the highest revenue
Show average rating by product category
Compare revenue and profit
Dynamic examples are generated based on detected:
- numeric columns
- categorical columns
- date columns
Automatically extracts:
- column names
- data types
- numeric columns
- categorical columns
Used to guide LLM SQL generation.
Gemini converts natural language into SQLite-compatible SQL queries.
Safety features:
- prevents write operations
- enforces schema usage
- validates query output
Runs SQL against a temporary in-memory SQLite database built from the uploaded DataFrame.
AI decides which visualization fits the result:
| Data Pattern | Chart |
|---|---|
| Category vs value | Bar |
| Time series | Line |
| Parts of whole | Pie |
| Numeric correlation | Scatter |
Gemini analyzes result tables and produces concise business insights.
Example:
β’ Gaming category generates the highest total views
β’ Engagement peaks during June and July
β’ Sentiment scores show strong positive correlation with likes
| Layer | Technology |
|---|---|
| UI | Streamlit |
| LLM | Google Gemini |
| Charts | Plotly |
| Data processing | Pandas |
| Query engine | SQLite (in-memory) |
| Environment | Python 3.10+ |
streamlit
pandas
plotly
google-generativeai
python-dotenv
numpy
statsmodels
pyarrow
- SQL generation depends on schema clarity
- Very large datasets (>500k rows) may slow execution
- Gemini rate limits apply on free tier
- Some ambiguous queries may generate suboptimal charts
Potential upgrades:
- Multi-dataset joins
- Dashboard export
- Chart editing
- LLM self-correction loops
- SQL execution sandboxing
- Live database connections
Pull requests welcome.
Steps:
1. Fork repo
2. Create branch
3. Implement feature
4. Submit PR
MIT License
Built for hackathon with questionable sleep and too much caffeine β.
InsightFlow-AI
Ask your data anything.