grasepard2 commited on
Commit
47ce43a
·
verified ·
1 Parent(s): 2ebd749

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -238,7 +238,18 @@ def ask_question(question):
238
  else:
239
  reply, key = keyword_answer(question)
240
 
241
- chart_fns = {"freq": chart_flag_frequency, "risk": chart_risk_distribution, "score": chart_score_distribution}
 
 
 
 
 
 
 
 
 
 
 
242
  chart = chart_fns[key]() if key in chart_fns else None
243
 
244
  return f"**Q:** {question}\n\n**A:** {reply}", chart
@@ -334,4 +345,4 @@ Each detected signal contributes to a total score that maps to Low / Medium / Hi
334
  - **v3** — Integrated n8n workflow for smarter conversational responses
335
  """)
336
 
337
- demo.launch()
 
238
  else:
239
  reply, key = keyword_answer(question)
240
 
241
+ # Accept multiple naming conventions for chart keys
242
+ chart_fns = {
243
+ "freq": chart_flag_frequency,
244
+ "flag_frequency": chart_flag_frequency,
245
+ "frequency": chart_flag_frequency,
246
+ "risk": chart_risk_distribution,
247
+ "risk_distribution": chart_risk_distribution,
248
+ "distribution": chart_risk_distribution,
249
+ "score": chart_score_distribution,
250
+ "score_distribution": chart_score_distribution,
251
+ "histogram": chart_score_distribution,
252
+ }
253
  chart = chart_fns[key]() if key in chart_fns else None
254
 
255
  return f"**Q:** {question}\n\n**A:** {reply}", chart
 
345
  - **v3** — Integrated n8n workflow for smarter conversational responses
346
  """)
347
 
348
+ demo.launch()