markytools commited on
Commit
cf43659
·
1 Parent(s): ba66a0a

default csv

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -91,15 +91,7 @@ else:
91
  llm = ChatOpenAI(model=OPEN_ROUTER_MODEL, temperature=0.1, openai_api_key=OPEN_ROUTER_KEY, openai_api_base="https://openrouter.ai/api/v1")
92
 
93
  pdfCSVURLText = ""
94
- if genre==radioButtonList[0]:
95
- pdfCSVURLText = "CSV"
96
- exampleQuestion = "Question1: What was the most sold item? Question2: What was the most common payment?"
97
- loader = CSVLoader(file_path='EcommerceDataset.csv')
98
- csv_data = loader.load()
99
- # st.write('You selected comedy.')
100
- # else:
101
- # st.write(f'''Password streamlit app: {st.secrets["PSWD"]}''')
102
- elif genre==radioButtonList[1]:
103
  pdfCSVURLText = "CSV"
104
  exampleQuestion = "What are the data columns?"
105
  elif genre==radioButtonList[2]:
@@ -111,6 +103,11 @@ else:
111
  elif genre==radioButtonList[4]:
112
  pdfCSVURLText = "URL"
113
  exampleQuestion = "Can you summarize the contents?"
 
 
 
 
 
114
 
115
  isCustomURL = genre==radioButtonList[4]
116
  urlInput = st.text_input('Enter your own URL', '', placeholder=f"Type your URL here (e.g. {defaultGoogleURL})", disabled=not isCustomURL)
@@ -130,9 +127,7 @@ else:
130
  pdf_pages = loader.load_and_split()
131
 
132
  enableChatBox = False
133
- if genre==radioButtonList[0]: # E-commerce CSV
134
- enableChatBox = True
135
- elif genre==radioButtonList[1]: # Custom CSV Upload
136
  enableChatBox = uploadedFilename[-4:]==".csv"
137
  elif genre==radioButtonList[2]: # Custom PDF Upload
138
  enableChatBox = uploadedFilename[-4:]==".pdf"
@@ -140,6 +135,8 @@ else:
140
  enableChatBox = True
141
  elif genre==radioButtonList[4]: # Custom URL
142
  enableChatBox = True
 
 
143
 
144
  chatTextStr = st.text_input(f'Ask me anything about this {pdfCSVURLText}', '', placeholder=f"Type here (e.g. {exampleQuestion})", disabled=not enableChatBox)
145
  chatWithPDFButton = "CLICK HERE TO START CHATTING"
 
91
  llm = ChatOpenAI(model=OPEN_ROUTER_MODEL, temperature=0.1, openai_api_key=OPEN_ROUTER_KEY, openai_api_base="https://openrouter.ai/api/v1")
92
 
93
  pdfCSVURLText = ""
94
+ if genre==radioButtonList[1]:
 
 
 
 
 
 
 
 
95
  pdfCSVURLText = "CSV"
96
  exampleQuestion = "What are the data columns?"
97
  elif genre==radioButtonList[2]:
 
103
  elif genre==radioButtonList[4]:
104
  pdfCSVURLText = "URL"
105
  exampleQuestion = "Can you summarize the contents?"
106
+ else: # Default, E-commerce CSV
107
+ pdfCSVURLText = "CSV"
108
+ exampleQuestion = "Question1: What was the most sold item? Question2: What was the most common payment?"
109
+ loader = CSVLoader(file_path='EcommerceDataset.csv')
110
+ csv_data = loader.load()
111
 
112
  isCustomURL = genre==radioButtonList[4]
113
  urlInput = st.text_input('Enter your own URL', '', placeholder=f"Type your URL here (e.g. {defaultGoogleURL})", disabled=not isCustomURL)
 
127
  pdf_pages = loader.load_and_split()
128
 
129
  enableChatBox = False
130
+ if genre==radioButtonList[1]: # Custom CSV Upload
 
 
131
  enableChatBox = uploadedFilename[-4:]==".csv"
132
  elif genre==radioButtonList[2]: # Custom PDF Upload
133
  enableChatBox = uploadedFilename[-4:]==".pdf"
 
135
  enableChatBox = True
136
  elif genre==radioButtonList[4]: # Custom URL
137
  enableChatBox = True
138
+ else: # E-commerce CSV
139
+ enableChatBox = True
140
 
141
  chatTextStr = st.text_input(f'Ask me anything about this {pdfCSVURLText}', '', placeholder=f"Type here (e.g. {exampleQuestion})", disabled=not enableChatBox)
142
  chatWithPDFButton = "CLICK HERE TO START CHATTING"