AI数据分系统

一个基于FastAPI和Streamlit的AI数据分系统,支持CSV数据集上传、AI分析和可视化展示。

  • by Hrishikesh1437
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Hrishikesh1437/MCP_Data_Analyst

使用说明

标记语言 复制代码

🚀 增强型MCP数据分析系统

该项目提供了一个 基于人工智能的数据分析系统 建造于 快速API, 溪流,以及 Gemini集成.
它允许用户上传CSV数据集,使用先进的人工智能见解进行分析,并在交互式Streamlit仪表板中可视化结果。


🧩 特性

  • 📊 上传和分析CSV数据集
  • 🤖 双子动力数据解释
  • ⚡ 使用FastAPI构建REST API
  • 🧠 自动数据汇总和类型推断
  • 🌐 Streamlit前端用于可视化
  • 🧱 模块化、生产就绪的结构

🏗️ 项目结构

mcp/ ├── src/ │ ├── config/ │ │ └── mcp_seetup.py#主服务器设置文件 │ ├── 路线/ │ │ └── csv_routes.py#文件上传和分析端点 │ ├── 工具/ │ │ ├── csv_tool.py#数据加载、清理、汇总函数 │ │ └── gemini_tool.py#人工智能分析逻辑 │ └── utils/ │ └── helpers.py#实用程序/辅助方法 ├── streamlit_app.py#用于可视化的streamlit UI ├── 需求.txt └── README.md

格式 复制代码


⚙️ 安装说明

1.️⃣ 克隆存储库

git clone https://github.com/<your-username>/<your-repo>.git
cd mcp
2️⃣ Create and Activate a Virtual Environment
bash
Copy code
# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate
3️⃣ Install Dependencies
bash
Copy code
pip install -r requirements.txt
🚀 Running the FastAPI Server
To start the backend API:

bash
Copy code
python src/config/mcp_setup.py
You should see:

csharp
Copy code
🚀 Starting MCP + HTTP Wrapper on http://localhost:8000 ...
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
✅ Then test it using curl or Postman:

bash
Copy code
curl http://localhost:8000/
Expected response:

json
Copy code
{"status":"running","message":"🚀 MCP Gemini Data Analysis API active"}
🧮 Upload and Analyze a CSV
You can upload a dataset using:

bash
Copy code
curl -X POST -F "file=@path/to/your.csv" http://localhost:8000/upload_csv/
💡 Streamlit Frontend
To run the Streamlit dashboard:

bash
Copy code
streamlit run streamlit_app.py
Then open the link it gives (usually http://localhost:8501) in your browser.

🧰 API Endpoints Summary
Endpoint	Method	Description
/	GET	Health check
/upload_csv/	POST	Upload a CSV and get summary
/analyze_csv_with_gemini/	POST	AI-powered analysis on uploaded data

🧠 Example Use Case
Upload a dataset like titanic.csv

The API summarizes data (rows, columns, stats)

Streamlit displays interactive visuals

Gemini interprets trends, correlations, and insights

🧾 Requirements
Python 3.10+

FastAPI

Uvicorn

Pandas

Streamlit

Google Gemini SDK (or compatible API)

🤝 Contributing
Feel free to fork and improve!
Pull requests are welcome for:

New AI analysis modes

Enhanced data visualization

Integration with databases (PostgreSQL, Neo4j, etc.)

🪪 License
MIT License © 2025 — Developed by Hrishikesh / BlackCoffer Training