chris-tn / chat_with_csv_streamlit_with_chart

In this repository, you will find an example code for creating an interactive chat experience that allows you to ask questions about your CSV data with chart visualization capabilities.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat with your CSV (with chart visualization)

In this repository, you will find an example code for creating an interactive chat experience that allows you to ask questions about your CSV data. The code uses Pandas Dataframe Agent from LangChain and a GPT model from Azure OpenAI Service to interact with the data. To make the chat more versatile, I incorporated some prompt engineering techniques that instruct the GPT model to use the popular data visualization library, Matplotlib, to create charts based on your queries. The chart is then saved and visualized using the Streamlit frontend interface. This feature can create any type of chart (pie, line, scatter, etc.) as long as you provide clear instructions. Additionally, the code can also return the dataframe as a table or provide a straightforward answer.

The data for analysis is sourced from Kaggle's Telco Customer Churn dataset, providing a comprehensive view of customer information to develop effective retention programs.

To run this Streamlit web app

streamlit run run.py

Sample query to give a straightforward answer. alt text

Sample query to show the result in the table. alt text

Sample query to show the result in a bar chart. alt text

Sample query to show the result in a pie chart. alt text

Enjoy!

About

In this repository, you will find an example code for creating an interactive chat experience that allows you to ask questions about your CSV data with chart visualization capabilities.


Languages

Language:Jupyter Notebook 87.5%Language:Python 12.5%