Shreyas094 commited on
Commit
f81e644
·
verified ·
1 Parent(s): 4336f84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -140,6 +140,14 @@ def update_vectors(files, parser):
140
  # Make sure to call this function at the start of your script
141
  load_uploaded_documents()
142
 
 
 
 
 
 
 
 
 
143
  def generate_chunked_response(prompt, model, max_tokens=10000, num_calls=3, temperature=0.2, should_stop=False):
144
  print(f"Starting generate_chunked_response with {num_calls} calls")
145
  full_response = ""
@@ -574,10 +582,6 @@ with demo:
574
  update_button = gr.Button("Upload Document")
575
 
576
  update_output = gr.Textbox(label="Update Status")
577
- document_selector = gr.CheckboxGroup(label="Select documents to query")
578
-
579
- # Initialize document selector
580
- document_selector = initialize_document_selector()
581
 
582
  # Update both the output text and the document selector
583
  update_button.click(update_vectors,
 
140
  # Make sure to call this function at the start of your script
141
  load_uploaded_documents()
142
 
143
+ def initialize_document_selector():
144
+ metadata = load_document_metadata()
145
+ return gr.CheckboxGroup(
146
+ choices=[doc["name"] for doc in metadata],
147
+ value=[doc["name"] for doc in metadata if doc["selected"]],
148
+ label="Select documents to query"
149
+ )
150
+
151
  def generate_chunked_response(prompt, model, max_tokens=10000, num_calls=3, temperature=0.2, should_stop=False):
152
  print(f"Starting generate_chunked_response with {num_calls} calls")
153
  full_response = ""
 
582
  update_button = gr.Button("Upload Document")
583
 
584
  update_output = gr.Textbox(label="Update Status")
 
 
 
 
585
 
586
  # Update both the output text and the document selector
587
  update_button.click(update_vectors,