mandrx commited on
Commit
03a4f3d
·
1 Parent(s): c757fe8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -18
app.py CHANGED
@@ -181,28 +181,36 @@ st.write("# GPT3 and Langchain Demo")
181
  # )
182
 
183
  # Sidebar
184
- st.sidebar.header("Options")
185
- st.sidebar.write("## File Upload:")
186
- data_files = st.sidebar.file_uploader(
187
- "upload", type=["pdf", "txt", "docx"], accept_multiple_files=True, label_visibility="hidden"
188
- )
189
  ALL_FILES = []
190
  META_DATA = []
191
- for data_file in data_files:
192
- # Upload file
193
- if data_file:
194
- file_path = Path(FILE_UPLOAD_PATH) / f"{uuid.uuid4().hex}_{data_file.name}"
195
- with open(file_path, "wb") as f:
196
- f.write(data_file.getbuffer())
197
- ALL_FILES.append(file_path)
198
- st.sidebar.write(str(data_file.name) + "    ✅ ")
199
- META_DATA.append({"filename": data_file.name})
200
  # ALL_FILES = ["./wellous_products.txt"]
201
  # "wellous_products.txt"
202
- # META_DATA.append({"filename": data_file.name})
203
-
204
- print(ALL_FILES)
205
- print(META_DATA)
 
 
 
 
 
 
 
 
206
 
207
  if len(ALL_FILES) > 0:
208
  # document_store.update_embeddings(retriever, update_existing_embeddings=False)
 
181
  # )
182
 
183
  # Sidebar
184
+ # st.sidebar.header("Options")
185
+ # st.sidebar.write("## File Upload:")
186
+ # data_files = st.sidebar.file_uploader(
187
+ # "upload", type=["pdf", "txt", "docx"], accept_multiple_files=True, label_visibility="hidden"
188
+ # )
189
  ALL_FILES = []
190
  META_DATA = []
191
+ # for data_file in data_files:
192
+ # # Upload file
193
+ # if data_file:
194
+ # file_path = Path(FILE_UPLOAD_PATH) / f"{uuid.uuid4().hex}_{data_file.name}"
195
+ # with open(file_path, "wb") as f:
196
+ # f.write(data_file.getbuffer())
197
+ # ALL_FILES.append(file_path)
198
+ # st.sidebar.write(str(data_file.name) + "    ✅ ")
199
+ # META_DATA.append({"filename": data_file.name})
200
  # ALL_FILES = ["./wellous_products.txt"]
201
  # "wellous_products.txt"
202
+ text_file = 'wellous_products.txt'
203
+ file_path = "./" f"{text_file}"
204
+ print("file_path",file_path)
205
+
206
+ with open(file_path, "wb") as f:
207
+ f.write(file_path.getbuffer())
208
+
209
+ ALL_FILES.append(file_path)
210
+ META_DATA.append({"filename": text_file})
211
+
212
+ print("ALL_FILES",ALL_FILES)
213
+ print("META_DATA",META_DATA)
214
 
215
  if len(ALL_FILES) > 0:
216
  # document_store.update_embeddings(retriever, update_existing_embeddings=False)