Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -448,6 +448,7 @@ def create_demo():
|
|
| 448 |
with gr.Blocks(title="PyVision's Online Demo", css="div.prose * {color: black !important;}") as demo:
|
| 449 |
gr.Markdown("# PyVision's Online Demo")
|
| 450 |
gr.Markdown("Upload an image and ask a question to get a response via PyVision's dynamic tooling ability.")
|
|
|
|
| 451 |
|
| 452 |
with gr.Row():
|
| 453 |
with gr.Column(scale=1):
|
|
@@ -466,16 +467,16 @@ def create_demo():
|
|
| 466 |
with gr.Row():
|
| 467 |
output = gr.HTML(label="Response")
|
| 468 |
|
| 469 |
-
with gr.Row():
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
|
| 475 |
-
# 添加导出按钮
|
| 476 |
-
with gr.Row():
|
| 477 |
-
|
| 478 |
-
|
| 479 |
|
| 480 |
# 存储当前结果的状态变量
|
| 481 |
current_images = gr.State([])
|
|
@@ -492,18 +493,18 @@ def create_demo():
|
|
| 492 |
outputs=[output, extracted_images, extracted_json, current_images, current_json]
|
| 493 |
)
|
| 494 |
|
| 495 |
-
# 处理导出
|
| 496 |
-
def handle_export(images, conversations):
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
export_btn.click(
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
)
|
| 507 |
|
| 508 |
# 示例部分
|
| 509 |
examples = [
|
|
|
|
| 448 |
with gr.Blocks(title="PyVision's Online Demo", css="div.prose * {color: black !important;}") as demo:
|
| 449 |
gr.Markdown("# PyVision's Online Demo")
|
| 450 |
gr.Markdown("Upload an image and ask a question to get a response via PyVision's dynamic tooling ability.")
|
| 451 |
+
gr.Markdown("[Project Page](https://agent-x.space/pyvision/), [Research Paper](https://example.com/pyvision-paper), [Inference Code](https://github.com/agents-x-project/PyVision)")
|
| 452 |
|
| 453 |
with gr.Row():
|
| 454 |
with gr.Column(scale=1):
|
|
|
|
| 467 |
with gr.Row():
|
| 468 |
output = gr.HTML(label="Response")
|
| 469 |
|
| 470 |
+
# with gr.Row():
|
| 471 |
+
# with gr.Column(scale=1):
|
| 472 |
+
# extracted_images = gr.Gallery(label="Extracted Images")
|
| 473 |
+
# with gr.Column(scale=1):
|
| 474 |
+
# extracted_json = gr.JSON(label="Extracted JSON")
|
| 475 |
|
| 476 |
+
# # 添加导出按钮
|
| 477 |
+
# with gr.Row():
|
| 478 |
+
# export_btn = gr.Button("Export to ZIP")
|
| 479 |
+
# download_file = gr.File(label="Download ZIP")
|
| 480 |
|
| 481 |
# 存储当前结果的状态变量
|
| 482 |
current_images = gr.State([])
|
|
|
|
| 493 |
outputs=[output, extracted_images, extracted_json, current_images, current_json]
|
| 494 |
)
|
| 495 |
|
| 496 |
+
# # 处理导出
|
| 497 |
+
# def handle_export(images, conversations):
|
| 498 |
+
# if not images or conversations is None:
|
| 499 |
+
# return None
|
| 500 |
+
# zip_path = export_to_zip(images, conversations)
|
| 501 |
+
# return zip_path
|
| 502 |
+
|
| 503 |
+
# export_btn.click(
|
| 504 |
+
# fn=handle_export,
|
| 505 |
+
# inputs=[current_images, current_json],
|
| 506 |
+
# outputs=[download_file]
|
| 507 |
+
# )
|
| 508 |
|
| 509 |
# 示例部分
|
| 510 |
examples = [
|