Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -594,39 +594,39 @@ def build_ui():
|
|
| 594 |
)
|
| 595 |
|
| 596 |
# ---- Tab 1: Index & Preview
|
| 597 |
-
with gr.Tab("1) Index & Preview"):
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
|
| 631 |
# ---- Tab 2: Ask (Direct — returns indices)
|
| 632 |
with gr.Tab("2) Direct Search"):
|
|
@@ -714,4 +714,5 @@ if __name__ == "__main__":
|
|
| 714 |
demo = build_ui()
|
| 715 |
# mcp_server=True exposes this app's MCP endpoint at /gradio_api/mcp/
|
| 716 |
# We keep the MCP server available, but the agent never uses MCP to pass images.
|
|
|
|
| 717 |
demo.queue(max_size=5).launch(debug=True, mcp_server=True)
|
|
|
|
| 594 |
)
|
| 595 |
|
| 596 |
# ---- Tab 1: Index & Preview
|
| 597 |
+
# with gr.Tab("1) Index & Preview"):
|
| 598 |
+
# with gr.Row():
|
| 599 |
+
# with gr.Column(scale=1):
|
| 600 |
+
# pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
|
| 601 |
+
# index_btn = gr.Button("📥 Index Uploaded PDF", variant="secondary")
|
| 602 |
+
# url_box = gr.Textbox(
|
| 603 |
+
# label="Or index from HF Dataset",
|
| 604 |
+
# placeholder="manu/test-dataset",
|
| 605 |
+
# value="",
|
| 606 |
+
# )
|
| 607 |
+
# index_url_btn = gr.Button("🌐 Load From HF Dataset", variant="secondary")
|
| 608 |
+
# status_box = gr.Textbox(label="Status", interactive=False)
|
| 609 |
+
# with gr.Column(scale=2):
|
| 610 |
+
# pdf_view = PDF(label="PDF Preview")
|
| 611 |
+
|
| 612 |
+
# # wiring
|
| 613 |
+
# def handle_upload(file):
|
| 614 |
+
# global current_pdf_path
|
| 615 |
+
# if file is None:
|
| 616 |
+
# return "Please upload a PDF.", None
|
| 617 |
+
# path = getattr(file, "name", file)
|
| 618 |
+
# status = index_from_path(path)
|
| 619 |
+
# current_pdf_path = path
|
| 620 |
+
# return status, path
|
| 621 |
+
|
| 622 |
+
# def handle_url(url: str):
|
| 623 |
+
# global current_pdf_path
|
| 624 |
+
# status, path = index_from_url(url)
|
| 625 |
+
# current_pdf_path = path
|
| 626 |
+
# return status, path
|
| 627 |
+
|
| 628 |
+
# index_btn.click(handle_upload, inputs=[pdf_input], outputs=[status_box, pdf_view])
|
| 629 |
+
# index_url_btn.click(handle_url, inputs=[url_box], outputs=[status_box, pdf_view])
|
| 630 |
|
| 631 |
# ---- Tab 2: Ask (Direct — returns indices)
|
| 632 |
with gr.Tab("2) Direct Search"):
|
|
|
|
| 714 |
demo = build_ui()
|
| 715 |
# mcp_server=True exposes this app's MCP endpoint at /gradio_api/mcp/
|
| 716 |
# We keep the MCP server available, but the agent never uses MCP to pass images.
|
| 717 |
+
print(index_from_url("vidore/esg_reports_human_labeled_v2"))
|
| 718 |
demo.queue(max_size=5).launch(debug=True, mcp_server=True)
|