CoolFace
Apppublic

harshkumar27/data-analysis-agent

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

TDS Data Analyst Agent

An intelligent, AI-powered data analyst agent that can answer questions about datasets, perform analysis, and generate visualizations. This agent is built with FastAPI and LangChain, leveraging the power of Google's Gemini models.

๐Ÿš€ Features

  • โ€”Interactive Web Interface: A user-friendly, responsive web UI for uploading files and viewing results.
  • โ€”Multiple Data Sources: Supports various data file formats, including CSV, Excel, Parquet, and JSON.
  • โ€”Web Scraping: Can fetch and analyze data directly from URLs.
  • โ€”AI-Powered Analysis: Uses LangChain and Google Gemini to understand questions and generate Python code for analysis.
  • โ€”Code Execution Sandbox: Safely executes generated code in a sandboxed environment.
  • โ€”Data Visualization: Generates and displays plots and charts based on the analysis.
  • โ€”Robust LLM Fallback: Implements a fallback mechanism for Gemini API keys to ensure reliability.
  • โ€”Easy Deployment: Ready for deployment on platforms like Railway with included configuration files.

๐Ÿ› ๏ธ Installation

To run this project locally, follow these steps:

  1. 1.Clone the repository:
bash
    git clone [https://github.com/your-username/your-repo.git](https://github.com/your-username/your-repo.git)
    cd your-repo
  1. 1.Create a virtual environment:
bash
    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  1. 1.Install the dependencies:
bash
    pip install -r requirements.txt
  1. 1.Create a `.env` file in the root directory and add your Google Gemini API keys. You can add up to 10 keys for load balancing. If you only have one, you can repeat it.
env
    gemini_api_1=your_api_key_here
    gemini_api_2=your_api_key_here
    # ... up to gemini_api_10
    LLM_TIMEOUT_SECONDS=240

Usage

To start the application, run the following command:

bash
uvicorn app:app --host 0.0.0.0 --port 8000