lorenzobalestra commited on
Commit
b69f126
Β·
verified Β·
1 Parent(s): 5923b09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -210,7 +210,7 @@ def load_kpis() -> Dict[str, Any]:
210
  # AI DASHBOARD -- LLM picks what to display
211
  # =========================================================
212
 
213
- DASHBOARD_SYSTEM = """You are an AI dashboard assistant for a book-sales analytics app.
214
  The user asks questions or requests about their data. You have access to pre-computed
215
  artifacts from a Python analysis pipeline.
216
 
@@ -381,7 +381,7 @@ def _keyword_fallback(msg: str, idx: Dict, kpis: Dict) -> Tuple[str, Dict]:
381
  if kpis:
382
  total = kpis.get("total_units_sold", 0)
383
  kpi_text = (
384
- f"Quick summary: **{kpis.get('n_titles', '?')}** book titles across "
385
  f"**{kpis.get('n_months', '?')}** months, with **{total:,.0f}** total units sold."
386
  )
387
 
@@ -393,7 +393,7 @@ def _keyword_fallback(msg: str, idx: Dict, kpis: Dict) -> Tuple[str, Dict]:
393
 
394
  if any(w in msg_lower for w in ["sentiment", "review", "positive", "negative"]):
395
  return (
396
- f"Here is the sentiment distribution across sampled book titles. {kpi_text}",
397
  {"show": "figure", "chart": "sentiment"},
398
  )
399
 
@@ -465,7 +465,7 @@ def render_kpi_cards() -> str:
465
  </div>"""
466
 
467
  kpi_config = [
468
- ("n_titles", "πŸ“š", "Book Titles", "#a48de8"),
469
  ("n_months", "πŸ“…", "Time Periods", "#7aa6f8"),
470
  ("total_units_sold", "πŸ“¦", "Units Sold", "#6ee7c7"),
471
  ("total_revenue", "πŸ’°", "Revenue", "#3dcba8"),
@@ -575,7 +575,7 @@ def build_sentiment_chart() -> go.Figure:
575
  ))
576
  fig.update_layout(**_styled_layout(
577
  height=max(400, len(df) * 28), barmode="stack",
578
- title=dict(text="Sentiment Distribution by Book"),
579
  ))
580
  fig.update_xaxes(title="Number of Reviews")
581
  fig.update_yaxes(autorange="reversed")
@@ -621,11 +621,11 @@ def load_css() -> str:
621
  with gr.Blocks(title="AIBDM 2026 Workshop App") as demo:
622
 
623
  gr.Markdown(
624
- "# SE21 App Template\n"
625
- "*This is an app template for SE21 students*",
626
  elem_id="escp_title",
627
  )
628
-
629
  # ===========================================================
630
  # TAB 1 -- Pipeline Runner
631
  # ===========================================================
 
210
  # AI DASHBOARD -- LLM picks what to display
211
  # =========================================================
212
 
213
+ DASHBOARD_SYSTEM = """You are an AI dashboard assistant for a wine-sales analytics app.
214
  The user asks questions or requests about their data. You have access to pre-computed
215
  artifacts from a Python analysis pipeline.
216
 
 
381
  if kpis:
382
  total = kpis.get("total_units_sold", 0)
383
  kpi_text = (
384
+ f"Quick summary: **{kpis.get('n_titles', '?')}** wine titles across "
385
  f"**{kpis.get('n_months', '?')}** months, with **{total:,.0f}** total units sold."
386
  )
387
 
 
393
 
394
  if any(w in msg_lower for w in ["sentiment", "review", "positive", "negative"]):
395
  return (
396
+ f"Here is the sentiment distribution across sampled wine titles. {kpi_text}",
397
  {"show": "figure", "chart": "sentiment"},
398
  )
399
 
 
465
  </div>"""
466
 
467
  kpi_config = [
468
+ ("n_titles", "πŸ“š", "wine Titles", "#a48de8"),
469
  ("n_months", "πŸ“…", "Time Periods", "#7aa6f8"),
470
  ("total_units_sold", "πŸ“¦", "Units Sold", "#6ee7c7"),
471
  ("total_revenue", "πŸ’°", "Revenue", "#3dcba8"),
 
575
  ))
576
  fig.update_layout(**_styled_layout(
577
  height=max(400, len(df) * 28), barmode="stack",
578
+ title=dict(text="Sentiment Distribution by wine"),
579
  ))
580
  fig.update_xaxes(title="Number of Reviews")
581
  fig.update_yaxes(autorange="reversed")
 
621
  with gr.Blocks(title="AIBDM 2026 Workshop App") as demo:
622
 
623
  gr.Markdown(
624
+ "# Wine Pricing Analytics\n"
625
+ "*AI-enhanced wine pricing optimization dashboard*",
626
  elem_id="escp_title",
627
  )
628
+ ,
629
  # ===========================================================
630
  # TAB 1 -- Pipeline Runner
631
  # ===========================================================