File size: 2,932 Bytes
e925362 3ba38b1 83b4de7 3ba38b1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
---
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
1. Clone the repository:
```bash
git clone https://huggingface.co/spaces/nader01/csv-agent
cd csv-agent
```
2. Create a virtual environment and activate it:
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
4. Set up your `.env` file with the Cohere API key:
```bash
COHERE_API_KEY=your_cohere_api_key
```
5. Run the application:
```bash
python csv_agent_with_chart.py
```
## π How to Use
1. **Upload a CSV File:**
- Click on the **Upload CSV** button.
- Select your CSV file to load the data.
- View a preview of your data.
2. **Ask a Question:**
- Enter your question in the **Ask a Question** box.
- Click **Submit Question** to receive a detailed answer.
3. **View Charts:**
- If the response includes a chart, it will be displayed below the response box.
4. **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](LICENSE) file for details.
---
Enjoy exploring your data with this **CSV Agent**! π
|