vishwask commited on
Commit
f931503
·
verified ·
1 Parent(s): b8bc3c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -240,13 +240,19 @@ def demo():
240
  collection_name = gr.State()
241
  pdf_directory = '/home/user/app/pdfs'
242
 
243
- pdf_files = [f for f in os.listdir(pdf_directory) if f.endswith(".pdf")]
244
- gr_files = [gr.File(os.path.join(pdf_directory, file)) for file in pdf_files]
 
 
 
 
 
 
245
 
246
  with gr.Row():
247
- # document = gr.Files(value = '/home/user/app/pdfs', height=100, file_count="multiple",visible=True,
248
  # file_types=["pdf"], interactive=True, label="Upload your PDF documents (single or multiple)")
249
- document = [gr.File(os.path.join(pdf_directory, file)) for file in pdf_files]
250
  with gr.Row():
251
  db_btn = gr.Radio(["ChromaDB"], label="Vector database type", value = "ChromaDB", type="index", info="Choose your vector database",visible=False)
252
  with gr.Accordion("Advanced options - Document text splitter", open=False, visible=False):
 
240
  collection_name = gr.State()
241
  pdf_directory = '/home/user/app/pdfs'
242
 
243
+ # List all PDF files in the directory
244
+ pdf_files = [os.path.join(pdf_directory, file) for file in os.listdir(pdf_directory) if file.endswith(".pdf")]
245
+
246
+ # Create a dictionary with the necessary information
247
+ pdf_dict = {"value": process_pdfs, "height": 100, "file_count": "multiple", "visible": True, "file_types": ["pdf"], "interactive": True, "label": "Uploaded PDF documents"}
248
+
249
+ # Create a gr.Files component with the dictionary
250
+ #document_files = gr.Files(**pdf_dict)
251
 
252
  with gr.Row():
253
+ # document = gr.Files(value = process_pdfs, height=100, file_count="multiple",visible=True,
254
  # file_types=["pdf"], interactive=True, label="Upload your PDF documents (single or multiple)")
255
+ document = gr.Files(**pdf_dict)
256
  with gr.Row():
257
  db_btn = gr.Radio(["ChromaDB"], label="Vector database type", value = "ChromaDB", type="index", info="Choose your vector database",visible=False)
258
  with gr.Accordion("Advanced options - Document text splitter", open=False, visible=False):