A newer version of the Gradio SDK is available:
6.5.1
title: Csv Agent
emoji: π’
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 5.15.0
app_file: app.py
pinned: false
license: mit
short_description: A sample Agentic Data Analyst
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
π CSV Agent with Cohere LLM and Langchain
This application is developed as a demonstration of an Agentic system that acts as a Data Analyst. A csv file can be loaded and analyzed by asking questions. Charts can also be requested and should be displayed by the agent.
The underlying LLM is a Cohere Command-R model, specifically command-r-plus-08-2024. The Agent also makes use of the LangChain framework.
π― Key Features
- Dynamic CSV Upload: Upload your CSV file effortlessly for instant analysis.
- Natural Language Queries: Ask questions in plain English, and the agent responds with data insights.
- Chart Generation: Visualize your data with auto-generated charts based on your queries.
- Interactive Interface: User-friendly interface built with Gradio for easy interaction.
- Agent Reset: Quickly reset the agent to upload new datasets without refreshing the page.
ποΈ Installation
Clone the repository:
git clone https://huggingface.co/spaces/nader01/csv-agent cd csv-agentCreate a virtual environment and activate it:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtSet up your
.envfile with the Cohere API key:COHERE_API_KEY=your_cohere_api_keyRun the application:
python csv_agent_with_chart.py
π How to Use
Upload a CSV File:
- Click on the Upload CSV button.
- Select your CSV file to load the data.
- View a preview of your data.
Ask a Question:
- Enter your question in the Ask a Question box.
- Click Submit Question to receive a detailed answer.
View Charts:
- If the response includes a chart, it will be displayed below the response box.
Reset Agent:
- Click Reset Agent to clear data and upload a new CSV file without refreshing the page.
π¨ User Interface Design
- Input & Output Boxes: Light blue background with bold, dark blue labels for easy readability.
- Interactive Elements: Buttons with responsive feedback for better user experience.
π§ Powered By
- Cohere AI: For natural language processing and data analysis.
- Gradio: For building the interactive user interface.
- Pandas: For efficient data handling.
π License
This project is licensed under the MIT License. See the LICENSE file for details.
Enjoy exploring your data with this CSV Agent! π