saad-sust commited on
Commit
7fd78c4
Β·
verified Β·
1 Parent(s): d6af5e8

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -1632,6 +1632,11 @@ def plot_graph(problem: str, sympy_info: dict):
1632
  plt.tight_layout()
1633
  st.pyplot(fig)
1634
  plt.close(fig) # free memory
 
 
 
 
 
1635
 
1636
  except Exception:
1637
  pass # silent fallback β€” never crash the app
@@ -1741,8 +1746,17 @@ def ask_ai(problem: str, sympy_info: dict, history: list) -> str:
1741
  " βœ… **Final Answer:** $$\\boxed{answer}$$\n"
1742
  " β†’ Never skip this structure. Never merge steps. Never jump to answer without showing work.\n"
1743
  " β†’ If user says plot/draw/graph/sketch/visualize: a real graph renders automatically.\n"
1744
- " Do NOT describe the graph in text. Do NOT draw ASCII art. Do NOT say you cannot draw.\n"
1745
- " Just say: 'πŸ“Š Here is the graph of $f(x) = ...$' and stop. Graph shows automatically.\n\n"
 
 
 
 
 
 
 
 
 
1746
 
1747
  "RULE 2 β€” LATEX (zero exceptions):\n"
1748
  " - Inline math (inside a sentence): $expression$\n"
 
1632
  plt.tight_layout()
1633
  st.pyplot(fig)
1634
  plt.close(fig) # free memory
1635
+ # Caption below graph
1636
+ deriv_label = " 🟠 f'(x)" if sympy_info.get("type") == "Derivative" else ""
1637
+ st.caption(f"πŸ“Š $y = {sp.latex(expr_sym)}$ "
1638
+ f"| x ∈ [{x_min}, {x_max}]"
1639
+ f"{deriv_label}")
1640
 
1641
  except Exception:
1642
  pass # silent fallback β€” never crash the app
 
1746
  " βœ… **Final Answer:** $$\\boxed{answer}$$\n"
1747
  " β†’ Never skip this structure. Never merge steps. Never jump to answer without showing work.\n"
1748
  " β†’ If user says plot/draw/graph/sketch/visualize: a real graph renders automatically.\n"
1749
+ " Do NOT draw ASCII art. Do NOT say you cannot draw.\n"
1750
+ " Give this SHORT response only β€” then graph renders below automatically:\n"
1751
+ " πŸ“Œ **Function:** state f(x) clearly in LaTeX\n"
1752
+ " πŸ” **Key Features:**\n"
1753
+ " - Domain and range\n"
1754
+ " - x-intercepts: solve f(x)=0\n"
1755
+ " - y-intercept: f(0)\n"
1756
+ " - Turning points / vertex if any\n"
1757
+ " - Behavior as $x \\to \\pm\\infty$\n"
1758
+ " πŸ“Š **Graph** is shown below.\n"
1759
+ " Keep it SHORT β€” max 8 lines. No long paragraphs. No step-by-step for graph requests.\n\n"
1760
 
1761
  "RULE 2 β€” LATEX (zero exceptions):\n"
1762
  " - Inline math (inside a sentence): $expression$\n"