| title | AI Data Analyst |
|---|---|
| emoji | ⚡ |
| colorFrom | blue |
| colorTo | indigo |
| sdk | docker |
| pinned | false |
| license | mit |
An AI-powered data analyst built with FastAPI and Google Gemini API. It accepts natural language questions and supporting files, then returns structured JSON answers, including data analysis and charts encoded as base64 images.
This app is designed for:
- 📊 Automated data analysis
- 📈 Chart generation (base64 PNGs)
You can checkout the app by clicking the below image link.
- ⚡ FastAPI async server – Handles multiple requests concurrently with high performance.
- 📝 Per-request server logging – Detailed logs for each request with request ID, client info, execution status, and timing.
- 🧠 Powered by Gemini – Leverages Google’s latest LLM for reasoning, analysis, and code generation.
- 🔀 Load balancing – Rotates across multiple Gemini API keys for improved stability and performance.
- 📂 File handling – Accepts both text (e.g., CSV, TXT, Markdown) and binary (e.g., images, PDFs) files.
- 🤖 Dynamic code generation – LLM generates Python code dynamically to answer questions.
- 🔄 Automatic error correction – Re-prompts Gemini to fix code when execution errors occur.
-
Clone the repository
git clone git@github.com:lightRajat/ai-data-analyst.git cd ai-data-analyst -
Install dependencies
uv sync
Note: If you don't have
uvinstalled, you can install it usingcurl -LsSf https://astral.sh/uv/install.sh | sh. -
Store your Gemini API keys inside
.envfile separated by commas.GEMINI_API_KEYS="key1,key2,key3" -
Run the app
uv run uvicorn main:app --host 0.0.0.0 --port 7860 --reload
Let's say you want to analyze a network interaction graph to find the most connected individual and visualize the network structure. You have your data in a file named edges.csv.
-
Upload Data: Drag and drop your
edges.csvfile into the Attachments zone. -
Define Analysis Task: You need to tell the AI what to do. You can type this directly into the Analysis Plan text box or drag and drop a text file (e.g.,
analysis.txt).Important: You must explicitly define the JSON response structure in your request. This tells the AI exactly what format to return so the dashboard can render charts and data correctly.
-
Run Analysis
Use the undirected network in `edges.csv`.
Return a JSON object with keys:
- `edge_count`: number
- `highest_degree_node`: string
- `average_degree`: number
- `density`: number
- `shortest_path_alice_eve`: number
- `network_graph`: base64 PNG string under 100kB
- `degree_histogram`: base64 PNG string under 100kBsource,target
Alice,Bob
Alice,Carol
Bob,Carol
Bob,David
Bob,Eve
Carol,David
David,EveThis project is licensed under the MIT License – see the LICENSE file for details.
