Shreyas094 commited on
Commit
f48c882
·
verified ·
1 Parent(s): 082553b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -131,11 +131,13 @@ def update_vectors(files, parser):
131
  save_document_metadata(metadata)
132
  logging.info("Document metadata saved")
133
 
134
- return f"Vector store updated successfully. Processed {total_chunks} chunks from {len(files)} files using {parser}.", gr.CheckboxGroup(
135
- choices=[doc["name"] for doc in metadata],
136
- value=[doc["name"] for doc in metadata if doc["selected"]],
137
- label="Select documents to query"
138
- )
 
 
139
 
140
  # Make sure to call this function at the start of your script
141
 
@@ -581,6 +583,7 @@ with demo:
581
  update_button = gr.Button("Upload Document")
582
 
583
  update_output = gr.Textbox(label="Update Status")
 
584
 
585
  # Update both the output text and the document selector
586
  update_button.click(update_vectors,
 
131
  save_document_metadata(metadata)
132
  logging.info("Document metadata saved")
133
 
134
+ completion_message = f"Vector store updated successfully. Processed {total_chunks} chunks from {len(files)} files using {parser}."
135
+ logging.info(completion_message)
136
+
137
+ updated_choices = [doc["name"] for doc in metadata]
138
+ updated_values = [doc["name"] for doc in metadata if doc["selected"]]
139
+
140
+ return completion_message, gr.CheckboxGroup.update(choices=updated_choices, value=updated_values, label="Select documents to query")
141
 
142
  # Make sure to call this function at the start of your script
143
 
 
583
  update_button = gr.Button("Upload Document")
584
 
585
  update_output = gr.Textbox(label="Update Status")
586
+ document_selector = gr.CheckboxGroup(label="Select documents to query")
587
 
588
  # Update both the output text and the document selector
589
  update_button.click(update_vectors,