aiscientist commited on
Commit
ed66cea
·
verified ·
1 Parent(s): fb8e7da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -1,15 +1,13 @@
1
-
2
  import streamlit as st
3
  import os
4
- os.environ['OPENAI_API_KEY'] = "YOUR API KEY"
5
-
6
- from langchain.llms.openai import OpenAI
7
- from langchain.agents.agent_types import AgentType
8
- #from langchain.agents import create_csv_agent
9
- from langchain_experimental.agents import create_csv_agent
10
- import time
11
 
12
  def main():
 
 
 
 
 
 
13
  st.title("Personal Assistant")
14
 
15
  uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
@@ -17,6 +15,12 @@ def main():
17
  st.warning("Please upload a CSV file.")
18
  st.stop() # Stop execution if no file uploaded
19
 
 
 
 
 
 
 
20
  llm = OpenAI(temperature=0)
21
  agent = create_csv_agent(
22
  llm,
 
 
1
  import streamlit as st
2
  import os
 
 
 
 
 
 
 
3
 
4
  def main():
5
+ st.sidebar.title("OpenAI Settings")
6
+
7
+ openai_api_key = st.sidebar.text_input("Enter your OpenAI API Key", type="password")
8
+
9
+ os.environ['OPENAI_API_KEY'] = openai_api_key
10
+
11
  st.title("Personal Assistant")
12
 
13
  uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
 
15
  st.warning("Please upload a CSV file.")
16
  st.stop() # Stop execution if no file uploaded
17
 
18
+ from langchain.llms.openai import OpenAI
19
+ from langchain.agents.agent_types import AgentType
20
+ #from langchain.agents import create_csv_agent
21
+ from langchain_experimental.agents import create_csv_agent
22
+ import time
23
+
24
  llm = OpenAI(temperature=0)
25
  agent = create_csv_agent(
26
  llm,