heikowagner commited on
Commit
80fe2b7
1 Parent(s): 1f84a9a
app/VectorStore/chroma-collections.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6500348785bdf69480c86a933feaa0dd3328a9acffda71e251ca9928c6813627
3
- size 957
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab6e5b0679e953f06abf1c6e74ddfc5ffafc233169ce2d6e08b99c1337c5e0cc
3
+ size 1036
app/utils.py CHANGED
@@ -52,8 +52,8 @@ def load_files():
52
  'Add to exsisting collection or create a new one',
53
  collections )
54
  if st.button('Delete Collection (⚠️ This is destructive and not reversible)'):
55
- client.delete_collection(name=selected_collection)
56
- retrieve_collections.clear()
57
  collections = retrieve_collections()
58
 
59
  option = st.radio(
@@ -68,8 +68,9 @@ def load_files():
68
  if st.button('Upload'):
69
  docs = load_from_file(uploaded_files)
70
  sub_docs = load_and_split(docs, chunk_size=int(chunk_size))
71
- create_and_add(selected_collection, sub_docs, None)
72
  uploaded_files=None
 
73
  else:
74
  st.write('Urls of Source Documents (Comma separated):')
75
  urls = chunk_size = st.text_area('Urls:', '')
@@ -79,14 +80,16 @@ def load_files():
79
  if st.button('Upload'):
80
  docs = load_from_web(urls)
81
  sub_docs = load_and_split(docs, chunk_size=int(chunk_size))
82
- create_and_add(selected_collection, sub_docs, None)
83
  uploaded_files=None
 
84
  else:
85
  collection = st.text_area('Name of your new collection:', '')
86
  model_name = st.text_area('Choose the embedding function:', "hkunlp/instructor-large")
87
  if st.button('Create'):
88
  if len(collection)>3:
89
  ef = load_embedding(model_name)
90
- client.create_collection(collection, embedding_function=ef)
91
- retrieve_collections.clear()
 
92
  st.write("Collection " +collection+" succesfully created.")
 
52
  'Add to exsisting collection or create a new one',
53
  collections )
54
  if st.button('Delete Collection (⚠️ This is destructive and not reversible)'):
55
+ client.delete_collection(name=selected_collection["name"])
56
+ #retrieve_collections.clear()
57
  collections = retrieve_collections()
58
 
59
  option = st.radio(
 
68
  if st.button('Upload'):
69
  docs = load_from_file(uploaded_files)
70
  sub_docs = load_and_split(docs, chunk_size=int(chunk_size))
71
+ create_and_add(selected_collection["name"], sub_docs, selected_collection['model_name'], {"model_name": selected_collection['model_name']})
72
  uploaded_files=None
73
+ st.write("Upload succesful")
74
  else:
75
  st.write('Urls of Source Documents (Comma separated):')
76
  urls = chunk_size = st.text_area('Urls:', '')
 
80
  if st.button('Upload'):
81
  docs = load_from_web(urls)
82
  sub_docs = load_and_split(docs, chunk_size=int(chunk_size))
83
+ create_and_add(selected_collection["name"], sub_docs, selected_collection['model_name'], {"model_name": selected_collection['model_name']})
84
  uploaded_files=None
85
+ st.write("Upload succesful")
86
  else:
87
  collection = st.text_area('Name of your new collection:', '')
88
  model_name = st.text_area('Choose the embedding function:', "hkunlp/instructor-large")
89
  if st.button('Create'):
90
  if len(collection)>3:
91
  ef = load_embedding(model_name)
92
+ metadata= {"loaded_docs":[], "Subject":"Terms Example", "model_name": ef.model_name}
93
+ client.create_collection(collection, embedding_function=ef, metadata=metadata)
94
+ # retrieve_collections.clear()
95
  st.write("Collection " +collection+" succesfully created.")