Update app.py
Browse files
app.py
CHANGED
@@ -74,10 +74,11 @@ if uploaded_file is not None:
|
|
74 |
pdf_vectors = embedding.encode(texts)
|
75 |
vector_count = len(documents)
|
76 |
example_data_generator = map(lambda i: (f'id-{i}', pdf_vectors[i], {"text": texts[i]}), range(vector_count))
|
77 |
-
if len(index.describe_index_stats()['namespaces'])!=0:
|
78 |
-
|
79 |
for ids_vectors_chunk in chunks(example_data_generator, batch_size=100):
|
80 |
index.upsert(vectors=ids_vectors_chunk)
|
|
|
81 |
|
82 |
# Search query related context
|
83 |
sample_query = st.text_input("Stellen Sie eine Frage zu dem PDF: (Ask a question related to the PDF:)")
|
|
|
74 |
pdf_vectors = embedding.encode(texts)
|
75 |
vector_count = len(documents)
|
76 |
example_data_generator = map(lambda i: (f'id-{i}', pdf_vectors[i], {"text": texts[i]}), range(vector_count))
|
77 |
+
#if len(index.describe_index_stats()['namespaces'])!=0:
|
78 |
+
# index.delete(delete_all=True)
|
79 |
for ids_vectors_chunk in chunks(example_data_generator, batch_size=100):
|
80 |
index.upsert(vectors=ids_vectors_chunk)
|
81 |
+
index.upsert(vectors=ids_vectors_chunk,namespace='ns1')
|
82 |
|
83 |
# Search query related context
|
84 |
sample_query = st.text_input("Stellen Sie eine Frage zu dem PDF: (Ask a question related to the PDF:)")
|