markytools commited on
Commit
7888633
·
1 Parent(s): 9e4c9f3

updated pom file

Browse files
Files changed (2) hide show
  1. EcommerceDataset.csv +0 -0
  2. app.py +29 -8
EcommerceDataset.csv ADDED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -29,9 +29,18 @@ genre = st.radio(
29
  "Choose dataset to finetune", radioButtonList
30
  )
31
 
 
 
 
 
 
 
 
 
32
  pdfCSVURLText = ""
33
  if genre==radioButtonList[0]:
34
  pdfCSVURLText = "CSV"
 
35
  # st.write('You selected comedy.')
36
  # else:
37
  # st.write(f'''Password streamlit app: {st.secrets["PSWD"]}''')
@@ -56,20 +65,32 @@ if uploaded_file is not None:
56
  uploadedFilename = f.name
57
 
58
  enableChatBox = False
59
- if genre==radioButtonList[0]:
60
  enableChatBox = True
61
- elif genre==radioButtonList[1]:
62
  enableChatBox = uploadedFilename[-4:]==".csv"
63
- elif genre==radioButtonList[2]:
64
  enableChatBox = uploadedFilename[-4:]==".pdf"
65
- elif genre==radioButtonList[3]:
66
  enableChatBox = True
67
- elif genre==radioButtonList[4]:
68
  enableChatBox = True
69
 
70
  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)
71
  chatWithPDFButton = "CLICK HERE TO START CHATTING"
72
  if st.button(chatWithPDFButton, disabled=not enableChatBox and not chatTextStr): # Button Cliked
73
- st.write('Invalid ULR. Please enter a valid URL.')
74
- # else:
75
- # pass
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  "Choose dataset to finetune", radioButtonList
30
  )
31
 
32
+ # Initialize language model
33
+ load_dotenv(find_dotenv()) # read local .env file
34
+ api_key = st.secrets["PALM_API_KEY"] # put your API key here
35
+ os.environ["GOOGLE_API_KEY"] = st.secrets["PALM_API_KEY"]
36
+ palm.configure(api_key=api_key)
37
+ llm = GooglePalm()
38
+ llm.temperature = 0.1
39
+
40
  pdfCSVURLText = ""
41
  if genre==radioButtonList[0]:
42
  pdfCSVURLText = "CSV"
43
+ dataDF = pd.read_csv('EcommerceDataset.csv', encoding= 'unicode_escape')
44
  # st.write('You selected comedy.')
45
  # else:
46
  # st.write(f'''Password streamlit app: {st.secrets["PSWD"]}''')
 
65
  uploadedFilename = f.name
66
 
67
  enableChatBox = False
68
+ if genre==radioButtonList[0]: # E-commerce CSV
69
  enableChatBox = True
70
+ elif genre==radioButtonList[1]: # Custom CSV Upload
71
  enableChatBox = uploadedFilename[-4:]==".csv"
72
+ elif genre==radioButtonList[2]: # Custom PDF Upload
73
  enableChatBox = uploadedFilename[-4:]==".pdf"
74
+ elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report
75
  enableChatBox = True
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
+
83
+
84
+ if genre==radioButtonList[0]: # E-commerce CSV
85
+ # Initializing the agent
86
+ agent = create_pandas_dataframe_agent(llm, dataDF, verbose=False)
87
+ answer = agent.run(chatTextStr)
88
+ st.write(answer)
89
+
90
+ elif genre==radioButtonList[1]: # Custom CSV Upload
91
+
92
+ elif genre==radioButtonList[2]: # Custom PDF Upload
93
+
94
+ elif genre==radioButtonList[3]: # Google Alphabet URL Earnings Report
95
+
96
+ elif genre==radioButtonList[4]: # Custom URL