Pro-Coder commited on
Commit
1506736
Β·
verified Β·
1 Parent(s): e1257cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -32
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.HTML(data_badge(
502
- "πŸ§ͺ <b>Source:</b> hand-written by the developer β€” 10 original knowledge-base "
503
- "articles on warehouse operations (AS/RS, AGV/AMR, WMS, sortation, picking, "
504
- "maintenance, safety) plus ~480 template-generated example queries. Not scraped "
505
- "or sourced from any real company.<br>"
506
- "<b>What it describes:</b> generic intralogistics/automation concepts and "
507
- "operational scenarios (equipment faults, safety incidents, order/inventory "
508
- "questions) β€” general domain knowledge, not any specific facility's live data.<br>"
509
- "<b>Function:</b> answers free-text warehouse-ops questions by first classifying "
510
- "the query's intent, retrieving the most relevant knowledge-base passage(s) "
511
- "(RAG), then generating a grounded answer with a hosted LLM β€” falling back to "
512
- "showing the retrieved passages directly if no LLM is available."
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.HTML(data_badge(
533
- f"πŸ§ͺ <b>Source:</b> randomly generated by the developer's code "
534
- f"(`src/data_generation.py`, fixed seed) β€” {len(inventory_df)} synthetic SKU "
535
- f"records and {len(orders_df)} synthetic orders. Not exported from any real "
536
- "company's WMS.<br>"
537
- "<b>What it describes:</b> a stand-in inventory table (SKU, category, zone, "
538
- "on-hand units, reorder point, unit cost) and orders table (order ID, status, "
539
- "line count, priority, zone) β€” realistic in shape and ranges, but fictional "
540
- "records, not live warehouse data.<br>"
541
- "<b>Function:</b> classifies whether a query is about inventory or order status, "
542
- "extracts SKU/order-ID/zone identifiers with regex, and filters the "
543
- "corresponding table β€” a lightweight stand-in for a natural-language WMS query "
544
- "tool."
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.HTML(data_badge(
611
- "πŸ§ͺ All charts below are computed on <b>held-out test data</b> by "
612
- "<code>build_artifacts.py</code> β€” fully reproducible, not cherry-picked."
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, ssr_mode=False)
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)