-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodeinterpreter.py
More file actions
29 lines (23 loc) · 1018 Bytes
/
Copy pathcodeinterpreter.py
File metadata and controls
29 lines (23 loc) · 1018 Bytes
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
import streamlit as st
from langchain.agents import create_csv_agent
from langchain.chat_models import ChatOpenAI
from langchain.agents.agent_types import AgentType
from langchain.llms import OpenAI
from dotenv import load_dotenv
import os
def main():
load_dotenv()
st.set_page_config(page_title="Hello, I am a Movie Chatbot. Ask me anything?")
st.header("Hello, I am a Movie Chatbot. Ask me anything?")
user_csv = "actors.csv"
os.environ["OPENAI_API_KEY"] =st.text_input("Enter your OpenAI API")
#user_question = input("Ask a question about your CSV ?")
user_question=st.text_input("Ask me a question about movies?")
llm = OpenAI(temperature=0)
agent = create_csv_agent(llm, user_csv, verbose="True",agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,)
if user_question is not None and user_question != "":
response = agent.run(user_question)
st.write(response)
print(response)
if __name__ == "__main__":
main()