markytools commited on
Commit
674ea12
·
1 Parent(s): 81b851a

updated pom file

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -63,6 +63,8 @@ if uploaded_file is not None:
63
  with NamedTemporaryFile(dir='.', suffix=f'.{pdfCSVURLText.lower()}') as f:
64
  f.write(uploaded_file.getbuffer())
65
  uploadedFilename = f.name
 
 
66
 
67
  enableChatBox = False
68
  if genre==radioButtonList[0]: # E-commerce CSV
@@ -76,7 +78,7 @@ elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report
76
  elif genre==radioButtonList[4]: # Custom URL
77
  enableChatBox = True
78
 
79
- chatTextStr = st.text_input(f'Ask me anything about this {pdfCSVURLText}', '', placeholder="Type your question here (e.g. what was the most sold item?)", disabled=not enableChatBox)
80
  chatWithPDFButton = "CLICK HERE TO START CHATTING"
81
  if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr): # Button Cliked
82
 
@@ -88,7 +90,11 @@ if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr):
88
  st.write(answer)
89
 
90
  elif genre==radioButtonList[1]: # Custom CSV Upload
91
- pass
 
 
 
 
92
  elif genre==radioButtonList[2]: # Custom PDF Upload
93
  pass
94
  elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report
 
63
  with NamedTemporaryFile(dir='.', suffix=f'.{pdfCSVURLText.lower()}') as f:
64
  f.write(uploaded_file.getbuffer())
65
  uploadedFilename = f.name
66
+ if genre==radioButtonList[1]: # Custom CSV Upload
67
+ dataDF = pd.read_csv(uploadedFilename, encoding= 'unicode_escape')
68
 
69
  enableChatBox = False
70
  if genre==radioButtonList[0]: # E-commerce CSV
 
78
  elif genre==radioButtonList[4]: # Custom URL
79
  enableChatBox = True
80
 
81
+ chatTextStr = st.text_input(f'Ask me anything about this {pdfCSVURLText}', '', placeholder="Type here (e.g. Question1: What was the most sold item? Question2: What was the most common payment?)", disabled=not enableChatBox)
82
  chatWithPDFButton = "CLICK HERE TO START CHATTING"
83
  if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr): # Button Cliked
84
 
 
90
  st.write(answer)
91
 
92
  elif genre==radioButtonList[1]: # Custom CSV Upload
93
+ # Initializing the agent
94
+ agent = create_pandas_dataframe_agent(llm, dataDF, verbose=False)
95
+ answer = agent.run(chatTextStr)
96
+ st.write(answer)
97
+
98
  elif genre==radioButtonList[2]: # Custom PDF Upload
99
  pass
100
  elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report