Update app.py
Browse files
app.py
CHANGED
@@ -240,13 +240,19 @@ def demo():
|
|
240 |
collection_name = gr.State()
|
241 |
pdf_directory = '/home/user/app/pdfs'
|
242 |
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
with gr.Row():
|
247 |
-
# document = gr.Files(value =
|
248 |
# file_types=["pdf"], interactive=True, label="Upload your PDF documents (single or multiple)")
|
249 |
-
document =
|
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):
|