Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,6 +58,11 @@ with left_col:
|
|
| 58 |
key="math_function",
|
| 59 |
on_change=reset_session_state
|
| 60 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
st.markdown("### Set Parameters")
|
| 63 |
initial_point = st.number_input(
|
|
@@ -77,9 +82,7 @@ with left_col:
|
|
| 77 |
) # Updates session state directly without reset
|
| 78 |
|
| 79 |
st.markdown("### Controls")
|
| 80 |
-
|
| 81 |
-
reset_session_state()
|
| 82 |
-
|
| 83 |
if st.button("🔄 Run Descent Step", type="primary"):
|
| 84 |
try:
|
| 85 |
gradient = compute_derivative(function_input, st.session_state.x_current)
|
|
@@ -91,6 +94,8 @@ with left_col:
|
|
| 91 |
st.session_state.current_index = st.session_state.iter_count
|
| 92 |
except Exception as e:
|
| 93 |
st.error(f"Error: {str(e)}")
|
|
|
|
|
|
|
| 94 |
|
| 95 |
# Right side content (Visualization and Iteration Details)
|
| 96 |
with right_col:
|
|
|
|
| 58 |
key="math_function",
|
| 59 |
on_change=reset_session_state
|
| 60 |
)
|
| 61 |
+
st.markdown("**Examples**:")
|
| 62 |
+
st.markdown("`np.sin(x)`")
|
| 63 |
+
st.markdown("`np.sin(x) + x**2`")
|
| 64 |
+
st.markdown("`x * np.sin(x)`")
|
| 65 |
+
st.markdown("`np.sin(x)**2 + x`")
|
| 66 |
|
| 67 |
st.markdown("### Set Parameters")
|
| 68 |
initial_point = st.number_input(
|
|
|
|
| 82 |
) # Updates session state directly without reset
|
| 83 |
|
| 84 |
st.markdown("### Controls")
|
| 85 |
+
|
|
|
|
|
|
|
| 86 |
if st.button("🔄 Run Descent Step", type="primary"):
|
| 87 |
try:
|
| 88 |
gradient = compute_derivative(function_input, st.session_state.x_current)
|
|
|
|
| 94 |
st.session_state.current_index = st.session_state.iter_count
|
| 95 |
except Exception as e:
|
| 96 |
st.error(f"Error: {str(e)}")
|
| 97 |
+
if st.button("🔄 Reset"):
|
| 98 |
+
reset_session_state()
|
| 99 |
|
| 100 |
# Right side content (Visualization and Iteration Details)
|
| 101 |
with right_col:
|