AnujithM commited on
Commit
97e77ef
·
verified ·
1 Parent(s): 86432ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -151,7 +151,7 @@ def rule_based_explanation(parsed: Parsed, info: dict):
151
  ]
152
  else:
153
  lines.append("• No independence assumption detected; standard conditional rule applied.")
154
- return "\\n".join(lines)
155
 
156
  def llm_explain(prompt):
157
  if llm is None:
@@ -171,7 +171,7 @@ def run(problem_text, user_reasoning):
171
  graph_img = make_graph_image(parsed, info)
172
  rb_text = rule_based_explanation(parsed, info)
173
  llm_out = llm_explain(
174
- f"Explain the mistake and minimal fix clearly:\\nProblem: {problem_text}\\nUser reasoning: {user_reasoning}\\n"
175
  f"Key facts: P(A)={parsed.pA}, P(B)={parsed.pB}, P(A∩B)={parsed.pAintB}.\\n"
176
  f"Computed P(A|B)={info['p_cond']}. Independence claimed: {info['independence_claimed']}. "
177
  f"Independence holds: {info['independence_holds']}.\\n"
@@ -184,11 +184,11 @@ def run(problem_text, user_reasoning):
184
  "Independence holds": info["independence_holds"],
185
  "P(A|B)": f"{info['p_cond']:.4f}" if info["p_cond"] is not None else "undefined",
186
  }
187
- stat_str = "\\n".join([f"{k}: {v}" for k,v in status.items()])
188
  return graph_img, final_text, stat_str
189
 
190
  with gr.Blocks(theme=gr.themes.Soft(primary_hue='indigo')) as demo:
191
- gr.Markdown("## Aicher (MVP) — Visual Causal Tutor\\n"
192
  "Enter a conditional-probability problem (or use the example). "
193
  "Optionally type your own reasoning to test independence errors.")
194
 
 
151
  ]
152
  else:
153
  lines.append("• No independence assumption detected; standard conditional rule applied.")
154
+ return "\n".join(lines)
155
 
156
  def llm_explain(prompt):
157
  if llm is None:
 
171
  graph_img = make_graph_image(parsed, info)
172
  rb_text = rule_based_explanation(parsed, info)
173
  llm_out = llm_explain(
174
+ f"Explain the mistake and minimal fix clearly:\nProblem: {problem_text}\nUser reasoning: {user_reasoning}\n"
175
  f"Key facts: P(A)={parsed.pA}, P(B)={parsed.pB}, P(A∩B)={parsed.pAintB}.\\n"
176
  f"Computed P(A|B)={info['p_cond']}. Independence claimed: {info['independence_claimed']}. "
177
  f"Independence holds: {info['independence_holds']}.\\n"
 
184
  "Independence holds": info["independence_holds"],
185
  "P(A|B)": f"{info['p_cond']:.4f}" if info["p_cond"] is not None else "undefined",
186
  }
187
+ stat_str = "\n".join([f"{k}: {v}" for k,v in status.items()])
188
  return graph_img, final_text, stat_str
189
 
190
  with gr.Blocks(theme=gr.themes.Soft(primary_hue='indigo')) as demo:
191
+ gr.Markdown("## Aicher (MVP) — Visual Causal Tutor\n"
192
  "Enter a conditional-probability problem (or use the example). "
193
  "Optionally type your own reasoning to test independence errors.")
194