marcellopoliti commited on
Commit
9221d01
1 Parent(s): ca7fa7a

feat: add csv file

Browse files
Files changed (1) hide show
  1. pages/manage_knowledge_box.py +17 -3
pages/manage_knowledge_box.py CHANGED
@@ -244,12 +244,25 @@ with tab2:
244
  # ADD CSV
245
  with tab3:
246
  list_manager()
247
-
248
- if st.button("add csv urls to collection"):
249
  res = add_links_to_knowledge_base(
250
  client=client, kb_name=collection_name, urls=st.session_state["url_list"]
251
  )
252
  st.write(res)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
 
254
 
255
  # Add PDF
@@ -306,7 +319,7 @@ with tab5:
306
  except Exception as e:
307
  st.error(f"{str(e)}")
308
 
309
-
310
  with tab6:
311
  st.header("Add Notion with JinaAI")
312
  url = st.text_input("Website url")
@@ -341,6 +354,7 @@ with tab6:
341
  except Exception as e:
342
  st.error(f"{str(e)}")
343
 
 
344
  with tab7:
345
 
346
  # remove a split
 
244
  # ADD CSV
245
  with tab3:
246
  list_manager()
247
+ if st.button("add urls to collection"):
 
248
  res = add_links_to_knowledge_base(
249
  client=client, kb_name=collection_name, urls=st.session_state["url_list"]
250
  )
251
  st.write(res)
252
+ st.text('The CSV should have the column named "urls"')
253
+ uploaded_file = st.file_uploader("Choose a file")
254
+ if uploaded_file is not None:
255
+ dataframe = pd.read_csv(uploaded_file)
256
+
257
+ unique_urls = dataframe["urls"].unique()
258
+ unique_urls_list = unique_urls.tolist()
259
+
260
+ if st.button("add CSV with urls to collection"):
261
+ add_links_to_knowledge_base(
262
+ client=client,
263
+ kb_name=collection_name,
264
+ urls=unique_urls_list,
265
+ )
266
 
267
 
268
  # Add PDF
 
319
  except Exception as e:
320
  st.error(f"{str(e)}")
321
 
322
+ ### NOTION WITH JINA AI ###
323
  with tab6:
324
  st.header("Add Notion with JinaAI")
325
  url = st.text_input("Website url")
 
354
  except Exception as e:
355
  st.error(f"{str(e)}")
356
 
357
+ ### RENAME COLLECTIONS ###
358
  with tab7:
359
 
360
  # remove a split