Spaces:
Build error
Build error
heikowagner
commited on
Commit
·
39b12fb
1
Parent(s):
09cd35e
add upload
Browse files- app/VectorStore/chroma-collections.parquet +2 -2
- app/load_vectors.py +2 -7
- app/utils.py +7 -3
app/VectorStore/chroma-collections.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79cf0a7bde715ca62bcfb8bf4f9a737f550dc282abdbde3a3d861114be54c984
|
3 |
+
size 967
|
app/load_vectors.py
CHANGED
@@ -49,13 +49,8 @@ def create_and_add(collection_name, sub_docs, model_name, metadata):
|
|
49 |
vectorstore.persist()
|
50 |
|
51 |
# Test Vectorstore
|
52 |
-
|
53 |
-
|
54 |
-
#embedding_function=embeddings,
|
55 |
-
#client_settings=client_settings,
|
56 |
-
#persist_directory=persist_directory,
|
57 |
-
#)
|
58 |
-
#print( vectorstore2.similarity_search_with_score(query="What are AXAs green Goals?", k=4) )
|
59 |
|
60 |
return vectorstore
|
61 |
|
|
|
49 |
vectorstore.persist()
|
50 |
|
51 |
# Test Vectorstore
|
52 |
+
vectorstore2 = load_vectorstore(model_name, collection_name, metadata = metadata)
|
53 |
+
print( vectorstore2.similarity_search_with_score(query="What are AXAs green Goals?", k=4) )
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
return vectorstore
|
56 |
|
app/utils.py
CHANGED
@@ -45,9 +45,8 @@ def load_files():
|
|
45 |
options=["Add Documents", "Start new collection"],
|
46 |
)
|
47 |
|
48 |
-
collections = retrieve_collections()
|
49 |
-
|
50 |
if option == "Add Documents":
|
|
|
51 |
selected_collection = st.selectbox(
|
52 |
'Add to exsisting collection or create a new one',
|
53 |
collections )
|
@@ -56,6 +55,8 @@ def load_files():
|
|
56 |
#retrieve_collections.clear()
|
57 |
collections = retrieve_collections()
|
58 |
|
|
|
|
|
59 |
option = st.radio(
|
60 |
"",
|
61 |
options=["Upload Files from Local", "Upload Files from Web"],
|
@@ -68,7 +69,10 @@ 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 |
-
|
|
|
|
|
|
|
72 |
uploaded_files=None
|
73 |
st.write("Upload succesful")
|
74 |
else:
|
|
|
45 |
options=["Add Documents", "Start new collection"],
|
46 |
)
|
47 |
|
|
|
|
|
48 |
if option == "Add Documents":
|
49 |
+
collections = retrieve_collections()
|
50 |
selected_collection = st.selectbox(
|
51 |
'Add to exsisting collection or create a new one',
|
52 |
collections )
|
|
|
55 |
#retrieve_collections.clear()
|
56 |
collections = retrieve_collections()
|
57 |
|
58 |
+
if selected_collection:
|
59 |
+
st.write("Selected Vectorstore:", selected_collection)
|
60 |
option = st.radio(
|
61 |
"",
|
62 |
options=["Upload Files from Local", "Upload Files from Web"],
|
|
|
69 |
if st.button('Upload'):
|
70 |
docs = load_from_file(uploaded_files)
|
71 |
sub_docs = load_and_split(docs, chunk_size=int(chunk_size))
|
72 |
+
print(sub_docs)
|
73 |
+
#create_and_add(selected_collection["name"], sub_docs, selected_collection['model_name'], {"model_name": selected_collection['model_name']})
|
74 |
+
create_and_add(selected_collection["name"], sub_docs, "hkunlp/instructor-large", metadata={"model_name": "hkunlp/instructor-large"})
|
75 |
+
|
76 |
uploaded_files=None
|
77 |
st.write("Upload succesful")
|
78 |
else:
|