ziyingsk commited on
Commit
220eb88
·
verified ·
1 Parent(s): d4d3d65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -74,10 +74,10 @@ 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 '( Default )' in index.describe_index_stats()['namespaces']:
78
- index.delete(delete_all=True,namespace='( Default )')
79
  for ids_vectors_chunk in chunks(example_data_generator, batch_size=100):
80
- index.upsert(vectors=ids_vectors_chunk,namespace='( Default )')
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 not index.describe_index_stats()['namespaces']:
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
 
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:)")