0% found this document useful (0 votes)
3 views3 pages

AI Chat App with CSV Using Langchain

This document is a tutorial for beginners on creating an AI application that interacts with a CSV file using Langchain and Streamlit. It explains how to set up a web app in Python that allows users to upload a CSV file and ask questions about its contents using a pandas dataframe agent and OpenAI. The tutorial includes code snippets for implementing the application functionality.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

AI Chat App with CSV Using Langchain

This document is a tutorial for beginners on creating an AI application that interacts with a CSV file using Langchain and Streamlit. It explains how to set up a web app in Python that allows users to upload a CSV file and ask questions about its contents using a pandas dataframe agent and OpenAI. The tutorial includes code snippets for implementing the application functionality.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

LANGCHAIN

COMPLETE
TUTORIAL FOR
BEGINNERS

Create An AI App To Talk With Your


Csv File Using Langchain &
Streamlit
TUTORIAL : 5
What is Streamlit

Streamlit turns data scripts into shareable web apps in minutes.


All in pure Python. No front‑end experience required.
AI App To Talk with csv file using pandas
dataframe agent and OpenAI
import streamlit as st
from [Link] import OpenAI
from [Link].agent_types import AgentType
from [Link] import create_pandas_dataframe_agent
import pandas as pd

st.set_page_config(page_title="AI APP TO TALK WITH CSV")


[Link]="ASK ANYTHING"

csv_file=st.file_uploader("upload your csv file",type="csv")


if csv_file is not None:
df=pd.read_csv("[Link]")

agent=create_pandas_dataframe_agent(llm=OpenAI(temperature=0),df=df,max_execution_time=1600,max_iterations=1000,verbose=True,agent_type=AgentType.ZERO_
SHOT_REACT_DESCRIPTION)
query=st.text_input("ask question to your csv")

if [Link]("Submit",type="primary"):
if query is not None:
response=[Link](query)
[Link](response)

You might also like