Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -498,19 +498,22 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), css=CUSTOM_CSS, title="
|
|
| 498 |
)
|
| 499 |
|
| 500 |
with gr.Tab("π¬ AI Assistant"):
|
| 501 |
-
gr.
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
|
|
|
|
|
|
|
|
|
| 514 |
gr.ChatInterface(
|
| 515 |
fn=chat_fn,
|
| 516 |
type="messages",
|
|
@@ -529,20 +532,25 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), css=CUSTOM_CSS, title="
|
|
| 529 |
test_llm_btn.click(test_llm_fn, inputs=None, outputs=test_llm_output)
|
| 530 |
|
| 531 |
with gr.Tab("π¦ Inventory & Order Query"):
|
| 532 |
-
gr.
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
with gr.Row():
|
| 547 |
inv_input = gr.Textbox(label="Query", placeholder="How many units of SKU-1042 are in Zone B?", scale=4)
|
| 548 |
inv_btn = gr.Button("Search", variant="primary", scale=1)
|
|
@@ -607,10 +615,11 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), css=CUSTOM_CSS, title="
|
|
| 607 |
)
|
| 608 |
|
| 609 |
with gr.Tab("π Model Evaluation"):
|
| 610 |
-
gr.
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
|
|
|
| 614 |
|
| 615 |
gr.Markdown("### 1. Intent Classifier β accuracy: **{:.1%}** Β· macro F1: **{:.1%}**".format(
|
| 616 |
intent_eval.get("accuracy", 0), intent_eval.get("macro_f1", 0)
|
|
@@ -659,6 +668,6 @@ if __name__ == "__main__":
|
|
| 659 |
# the Space if so.
|
| 660 |
launch_kwargs = dict(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
|
| 661 |
try:
|
| 662 |
-
demo.launch(**launch_kwargs,
|
| 663 |
except TypeError:
|
| 664 |
demo.launch(**launch_kwargs)
|
|
|
|
| 498 |
)
|
| 499 |
|
| 500 |
with gr.Tab("π¬ AI Assistant"):
|
| 501 |
+
with gr.Accordion("βΉοΈ About this AI Assistant & Data Source", open=False):
|
| 502 |
+
gr.HTML(data_badge(
|
| 503 |
+
"π§ͺ <b>Source:</b> hand-written by the developer β 10 original knowledge-base "
|
| 504 |
+
"articles on warehouse operations (AS/RS, AGV/AMR, WMS, sortation, picking, "
|
| 505 |
+
"maintenance, safety) plus ~480 template-generated example queries. "
|
| 506 |
+
"Not scraped or sourced from any real company.<br>"
|
| 507 |
+
|
| 508 |
+
"<b>What it describes:</b> generic intralogistics/automation concepts and "
|
| 509 |
+
"operational scenarios (equipment faults, safety incidents, order/inventory "
|
| 510 |
+
"questions) β general domain knowledge, not any specific facility's live data.<br>"
|
| 511 |
+
|
| 512 |
+
"<b>Function:</b> answers free-text warehouse-ops questions by first classifying "
|
| 513 |
+
"the query's intent, retrieving the most relevant knowledge-base passage(s) "
|
| 514 |
+
"(RAG), then generating a grounded answer with a hosted LLM β falling back to "
|
| 515 |
+
"showing the retrieved passages directly if no LLM is available."
|
| 516 |
+
))
|
| 517 |
gr.ChatInterface(
|
| 518 |
fn=chat_fn,
|
| 519 |
type="messages",
|
|
|
|
| 532 |
test_llm_btn.click(test_llm_fn, inputs=None, outputs=test_llm_output)
|
| 533 |
|
| 534 |
with gr.Tab("π¦ Inventory & Order Query"):
|
| 535 |
+
with gr.Accordion("βΉοΈ About Data & Query System", open=False):
|
| 536 |
+
gr.HTML(data_badge(
|
| 537 |
+
f"π§ͺ <b>Source:</b> randomly generated by the developer's code "
|
| 538 |
+
f"(<code>src/data_generation.py</code>, fixed seed) β "
|
| 539 |
+
f"{len(inventory_df)} synthetic SKU records and "
|
| 540 |
+
f"{len(orders_df)} synthetic orders. "
|
| 541 |
+
"Not exported from any real company's WMS.<br>"
|
| 542 |
+
|
| 543 |
+
"<b>What it describes:</b> a stand-in inventory table "
|
| 544 |
+
"(SKU, category, zone, on-hand units, reorder point, unit cost) "
|
| 545 |
+
"and orders table (order ID, status, line count, priority, zone) β "
|
| 546 |
+
"realistic in shape and ranges, but fictional records, not live "
|
| 547 |
+
"warehouse data.<br>"
|
| 548 |
+
|
| 549 |
+
"<b>Function:</b> classifies whether a query is about inventory or "
|
| 550 |
+
"order status, extracts SKU/order-ID/zone identifiers with regex, "
|
| 551 |
+
"and filters the corresponding table β a lightweight stand-in "
|
| 552 |
+
"for a natural-language WMS query tool."
|
| 553 |
+
))
|
| 554 |
with gr.Row():
|
| 555 |
inv_input = gr.Textbox(label="Query", placeholder="How many units of SKU-1042 are in Zone B?", scale=4)
|
| 556 |
inv_btn = gr.Button("Search", variant="primary", scale=1)
|
|
|
|
| 615 |
)
|
| 616 |
|
| 617 |
with gr.Tab("π Model Evaluation"):
|
| 618 |
+
with gr.Accordion("βΉοΈ About Model Evaluation", open=False):
|
| 619 |
+
gr.HTML(data_badge(
|
| 620 |
+
"π§ͺ All charts below are computed on <b>held-out test data</b> "
|
| 621 |
+
"by <code>build_artifacts.py</code> β fully reproducible."
|
| 622 |
+
))
|
| 623 |
|
| 624 |
gr.Markdown("### 1. Intent Classifier β accuracy: **{:.1%}** Β· macro F1: **{:.1%}**".format(
|
| 625 |
intent_eval.get("accuracy", 0), intent_eval.get("macro_f1", 0)
|
|
|
|
| 668 |
# the Space if so.
|
| 669 |
launch_kwargs = dict(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
|
| 670 |
try:
|
| 671 |
+
demo.launch(**launch_kwargs, ssr=False)
|
| 672 |
except TypeError:
|
| 673 |
demo.launch(**launch_kwargs)
|