Spaces:
Paused
Paused
Shreyas094
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -658,8 +658,8 @@ demo = gr.ChatInterface(
|
|
658 |
gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[3]),
|
659 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.2, step=0.1, label="Temperature"),
|
660 |
gr.Slider(minimum=1, maximum=5, value=1, step=1, label="Number of API Calls"),
|
661 |
-
gr.
|
662 |
-
gr.
|
663 |
],
|
664 |
title="AI-powered PDF Chat and Web Search Assistant",
|
665 |
description="Chat with your PDFs or use web search to answer questions.",
|
@@ -700,10 +700,10 @@ demo = gr.ChatInterface(
|
|
700 |
)
|
701 |
)
|
702 |
|
|
|
703 |
# Add file upload functionality
|
704 |
with demo:
|
705 |
gr.Markdown("## Upload and Manage PDF Documents")
|
706 |
-
|
707 |
with gr.Row():
|
708 |
file_input = gr.Files(label="Upload your PDF documents", file_types=[".pdf"])
|
709 |
parser_dropdown = gr.Dropdown(choices=["pypdf", "llamaparse"], label="Select PDF Parser", value="llamaparse")
|
@@ -712,21 +712,27 @@ with demo:
|
|
712 |
|
713 |
update_output = gr.Textbox(label="Update Status")
|
714 |
delete_button = gr.Button("Delete Selected Documents")
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
|
|
|
|
721 |
# Add the refresh button functionality
|
722 |
-
refresh_button.click(
|
723 |
-
|
724 |
-
|
|
|
|
|
725 |
|
726 |
# Add the delete button functionality
|
727 |
-
delete_button.click(
|
728 |
-
|
729 |
-
|
|
|
|
|
730 |
|
731 |
gr.Markdown(
|
732 |
"""
|
|
|
658 |
gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[3]),
|
659 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.2, step=0.1, label="Temperature"),
|
660 |
gr.Slider(minimum=1, maximum=5, value=1, step=1, label="Number of API Calls"),
|
661 |
+
gr.Checkbox(label="Use Web Search", value=True),
|
662 |
+
gr.CheckboxGroup(label="Select documents to query", choices=[])
|
663 |
],
|
664 |
title="AI-powered PDF Chat and Web Search Assistant",
|
665 |
description="Chat with your PDFs or use web search to answer questions.",
|
|
|
700 |
)
|
701 |
)
|
702 |
|
703 |
+
# Add file upload functionality
|
704 |
# Add file upload functionality
|
705 |
with demo:
|
706 |
gr.Markdown("## Upload and Manage PDF Documents")
|
|
|
707 |
with gr.Row():
|
708 |
file_input = gr.Files(label="Upload your PDF documents", file_types=[".pdf"])
|
709 |
parser_dropdown = gr.Dropdown(choices=["pypdf", "llamaparse"], label="Select PDF Parser", value="llamaparse")
|
|
|
712 |
|
713 |
update_output = gr.Textbox(label="Update Status")
|
714 |
delete_button = gr.Button("Delete Selected Documents")
|
715 |
+
|
716 |
+
# Update both the output text and the document selector
|
717 |
+
update_button.click(
|
718 |
+
update_vectors,
|
719 |
+
inputs=[file_input, parser_dropdown],
|
720 |
+
outputs=[update_output, demo.additional_inputs[-1]] # Use the CheckboxGroup from additional_inputs
|
721 |
+
)
|
722 |
+
|
723 |
# Add the refresh button functionality
|
724 |
+
refresh_button.click(
|
725 |
+
refresh_documents,
|
726 |
+
inputs=[],
|
727 |
+
outputs=[demo.additional_inputs[-1]] # Use the CheckboxGroup from additional_inputs
|
728 |
+
)
|
729 |
|
730 |
# Add the delete button functionality
|
731 |
+
delete_button.click(
|
732 |
+
delete_documents,
|
733 |
+
inputs=[demo.additional_inputs[-1]], # Use the CheckboxGroup from additional_inputs
|
734 |
+
outputs=[update_output, demo.additional_inputs[-1]]
|
735 |
+
)
|
736 |
|
737 |
gr.Markdown(
|
738 |
"""
|