|
@@ -9,6 +9,7 @@ import pandas as pd
|
|
|
from utils import Service
|
|
from utils import Service
|
|
|
|
|
|
|
|
brand_list = Service.get_brand_list()
|
|
brand_list = Service.get_brand_list()
|
|
|
|
|
+init_product_list = Service.get_init_state_product_list(brand_list[0])
|
|
|
|
|
|
|
|
with gr.Blocks() as demo:
|
|
with gr.Blocks() as demo:
|
|
|
gr.Markdown("## 侵权识别系统", elem_id="header")
|
|
gr.Markdown("## 侵权识别系统", elem_id="header")
|
|
@@ -22,9 +23,19 @@ with gr.Blocks() as demo:
|
|
|
value=brand_list[0],
|
|
value=brand_list[0],
|
|
|
interactive=True)
|
|
interactive=True)
|
|
|
|
|
|
|
|
- search_box = gr.Textbox(label="搜索商户")
|
|
|
|
|
- search_button = gr.Button("搜索")
|
|
|
|
|
|
|
+ product_dropdown = gr.Dropdown(
|
|
|
|
|
+ init_product_list,
|
|
|
|
|
+ value=init_product_list[0],
|
|
|
|
|
+ label="商品列表",
|
|
|
|
|
+ interactive=True
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
check_button = gr.Button("查询侵权")
|
|
check_button = gr.Button("查询侵权")
|
|
|
|
|
+ infringement_result = gr.Textbox(
|
|
|
|
|
+ label="侵权识别结果",
|
|
|
|
|
+ interactive=False,
|
|
|
|
|
+ lines=3
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
with gr.Column(): # 右侧展示面板
|
|
with gr.Column(): # 右侧展示面板
|
|
|
# 1. 图片展示区(顶部)
|
|
# 1. 图片展示区(顶部)
|
|
@@ -57,18 +68,13 @@ with gr.Blocks() as demo:
|
|
|
interactive=False # 设为True可允许编辑
|
|
interactive=False # 设为True可允许编辑
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- # 3. 侵权结果区(底部)
|
|
|
|
|
- infringement_result = gr.Textbox(
|
|
|
|
|
- label="侵权识别结果",
|
|
|
|
|
- interactive=False,
|
|
|
|
|
- lines=3
|
|
|
|
|
- )
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
# 事件绑定(保持不变)
|
|
# 事件绑定(保持不变)
|
|
|
brand_dropdown.change(
|
|
brand_dropdown.change(
|
|
|
- fn=lambda x: x,
|
|
|
|
|
|
|
+ fn=Service.on_brand_change,
|
|
|
inputs=brand_dropdown,
|
|
inputs=brand_dropdown,
|
|
|
- outputs=brand_state
|
|
|
|
|
|
|
+ outputs=product_dropdown
|
|
|
)
|
|
)
|
|
|
# search_button.click(search_by_cust_id, inputs=search_box, outputs=[product_info, image_display])
|
|
# search_button.click(search_by_cust_id, inputs=search_box, outputs=[product_info, image_display])
|
|
|
# check_button.click(check_infringement, inputs=[...], outputs=infringement_result)
|
|
# check_button.click(check_infringement, inputs=[...], outputs=infringement_result)
|