File size: 884 Bytes
c377afe 611d61b b8c9100 c377afe |
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 |
import streamlit as st
from langchain.llms import OpenAI
from langchain_experimental.agents.agent_toolkits import create_csv_agent
from langchain.agents import AgentType
def main():
st.set_page_config(page_title="Talk to your Data - AI Assistant", page_icon=":robot:")
st.title('DataCompanion AI Assistant :robot_face:')
st.subheader(':blue[by Venkat Reddy] :sunglasses:')
input_csv=st.file_uploader("Upload a CSV file", type=["csv"])
if input_csv:
st.write("Ask any question to your data")
user_question=st.text_input("Ask a question on your data")
agent=create_csv_agent(OpenAI(temperature=0),
input_csv,
allow_dangerous_code=True,
agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION)
result=agent.run(user_question)
st.write(result)
if __name__ == "__main__":
main() |