mandrx commited on
Commit
2df31f3
1 Parent(s): 03a4f3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -16
app.py CHANGED
@@ -188,26 +188,31 @@ st.write("# GPT3 and Langchain Demo")
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)
 
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
+
196
+ print("file_path",file_path)
197
+ print("data_file",data_file)
198
+ print("data_file.getbuffer()",data_file.getbuffer())
199
+
200
+ with open(file_path, "wb") as f:
201
+ f.write(data_file.getbuffer())
202
+ ALL_FILES.append(file_path)
203
+ st.sidebar.write(str(data_file.name) + "    ✅ ")
204
+ META_DATA.append({"filename": data_file.name})
205
  # ALL_FILES = ["./wellous_products.txt"]
206
  # "wellous_products.txt"
207
+ # text_file = 'wellous_products.txt'
208
+ # file_path = "./" f"{text_file}"
209
+ # print("file_path",file_path)
210
 
211
+ # with open(file_path, "wb") as f:
212
+ # f.write(file_path.getbuffer())
213
 
214
+ # ALL_FILES.append(file_path)
215
+ # META_DATA.append({"filename": text_file})
216
 
217
  print("ALL_FILES",ALL_FILES)
218
  print("META_DATA",META_DATA)