NaderAfshar
commited on
Commit
Β·
3ba38b1
1
Parent(s):
83d7c0c
Updated the README file
Browse files
README.md
CHANGED
|
@@ -12,3 +12,91 @@ short_description: A sample Agentic Data Analyst
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 15 |
+
|
| 16 |
+
# π CSV Agent with Cohere LLM and Langchain
|
| 17 |
+
|
| 18 |
+
This application is developed as a demonstration of an Agentic system that acts as
|
| 19 |
+
a Data Analyst. A csv file can be loaded and analyzed by asking questions. Charts can also
|
| 20 |
+
be requested and should be displayed by the agent.
|
| 21 |
+
|
| 22 |
+
The underlying LLM is a **Cohere Command-R** model, specifically **command-r-plus-08-2024**. The
|
| 23 |
+
Agent also makes use of the LangChain framework.
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## π― Key Features
|
| 27 |
+
|
| 28 |
+
- **Dynamic CSV Upload:** Upload your CSV file effortlessly for instant analysis.
|
| 29 |
+
- **Natural Language Queries:** Ask questions in plain English, and the agent responds with data insights.
|
| 30 |
+
- **Chart Generation:** Visualize your data with auto-generated charts based on your queries.
|
| 31 |
+
- **Interactive Interface:** User-friendly interface built with Gradio for easy interaction.
|
| 32 |
+
- **Agent Reset:** Quickly reset the agent to upload new datasets without refreshing the page.
|
| 33 |
+
|
| 34 |
+
## ποΈ Installation
|
| 35 |
+
|
| 36 |
+
1. Clone the repository:
|
| 37 |
+
```bash
|
| 38 |
+
git clone https://huggingface.co/spaces/nader01/csv-agent
|
| 39 |
+
cd csv-agent
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
2. Create a virtual environment and activate it:
|
| 43 |
+
```bash
|
| 44 |
+
python -m venv .venv
|
| 45 |
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
3. Install dependencies:
|
| 49 |
+
```bash
|
| 50 |
+
pip install -r requirements.txt
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
4. Set up your `.env` file with the Cohere API key:
|
| 54 |
+
```bash
|
| 55 |
+
COHERE_API_KEY=your_cohere_api_key
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
5. Run the application:
|
| 59 |
+
```bash
|
| 60 |
+
python csv_agent_with_chart.py
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## π How to Use
|
| 64 |
+
|
| 65 |
+
1. **Upload a CSV File:**
|
| 66 |
+
- Click on the **Upload CSV** button.
|
| 67 |
+
- Select your CSV file to load the data.
|
| 68 |
+
- View a preview of your data.
|
| 69 |
+
|
| 70 |
+
2. **Ask a Question:**
|
| 71 |
+
- Enter your question in the **Ask a Question** box.
|
| 72 |
+
- Click **Submit Question** to receive a detailed answer.
|
| 73 |
+
|
| 74 |
+
3. **View Charts:**
|
| 75 |
+
- If the response includes a chart, it will be displayed below the response box.
|
| 76 |
+
|
| 77 |
+
4. **Reset Agent:**
|
| 78 |
+
- Click **Reset Agent** to clear data and upload a new CSV file without refreshing the page.
|
| 79 |
+
|
| 80 |
+
## π¨ User Interface Design
|
| 81 |
+
|
| 82 |
+
- **Input & Output Boxes:** Light blue background with bold, dark blue labels for easy readability.
|
| 83 |
+
- **Interactive Elements:** Buttons with responsive feedback for better user experience.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
|
| 87 |
+
## π§ Powered By
|
| 88 |
+
|
| 89 |
+
- **Cohere AI:** For natural language processing and data analysis.
|
| 90 |
+
- **Gradio:** For building the interactive user interface.
|
| 91 |
+
- **Pandas:** For efficient data handling.
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
## π License
|
| 95 |
+
|
| 96 |
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
Enjoy exploring your data with this **CSV Agent**! π
|
| 101 |
+
|
| 102 |
+
|