aiscientist commited on
Commit
7df306a
·
verified ·
1 Parent(s): f0769fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -1,4 +1,4 @@
1
-
2
  import streamlit as st
3
  import os
4
  os.environ['OPENAI_API_KEY'] = "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"
@@ -12,16 +12,15 @@ import time
12
  def main():
13
  st.title("Personal Assistant")
14
 
15
- csv_file_path = "personal.csv" # Default CSV file path
16
-
17
  uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
18
- if uploaded_file is not None:
19
- csv_file_path = uploaded_file.name
 
20
 
21
  llm = OpenAI(temperature=0)
22
  agent = create_csv_agent(
23
  llm,
24
- csv_file_path,
25
  verbose=False,
26
  agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
27
  )
 
1
+ %%writefile app.py
2
  import streamlit as st
3
  import os
4
  os.environ['OPENAI_API_KEY'] = "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"
 
12
  def main():
13
  st.title("Personal Assistant")
14
 
 
 
15
  uploaded_file = st.file_uploader("Upload CSV file", type=["csv"])
16
+ if uploaded_file is None:
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,
23
+ uploaded_file,
24
  verbose=False,
25
  agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
26
  )