Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,24 +66,10 @@ def update_iteration(step):
|
|
| 66 |
st.session_state.x = st.session_state.x_vals[st.session_state.iteration]
|
| 67 |
st.session_state.y_vals = [safe_eval(func_input, st.session_state.x)]
|
| 68 |
|
| 69 |
-
# Button handlers for iteration
|
| 70 |
-
col1, col2, col3 = st.columns([1, 3, 1])
|
| 71 |
-
with col1:
|
| 72 |
-
if st.button("⏪ Previous", key="prev", on_click=update_iteration, args=(-1,)):
|
| 73 |
-
pass
|
| 74 |
-
|
| 75 |
-
with col2:
|
| 76 |
-
if st.button("🔄 Current Iteration", key="current"):
|
| 77 |
-
st.write(f"Iteration: {st.session_state.iteration}")
|
| 78 |
-
st.write(f"Current x: {st.session_state.x:.4f}")
|
| 79 |
-
st.write(f"f(x): {st.session_state.y_vals[-1]:.4f}")
|
| 80 |
|
| 81 |
-
with col3:
|
| 82 |
-
if st.button("⏩ Next", key="next", on_click=update_iteration, args=(1,)):
|
| 83 |
-
pass
|
| 84 |
|
| 85 |
# Buttons to run descent step and reset
|
| 86 |
-
|
| 87 |
with col4:
|
| 88 |
if st.button("🔄 Run Descent Step"):
|
| 89 |
grad = derivative(func_input, st.session_state.x)
|
|
|
|
| 66 |
st.session_state.x = st.session_state.x_vals[st.session_state.iteration]
|
| 67 |
st.session_state.y_vals = [safe_eval(func_input, st.session_state.x)]
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
# Buttons to run descent step and reset
|
| 72 |
+
col1, col2 = st.columns([1, 1])
|
| 73 |
with col4:
|
| 74 |
if st.button("🔄 Run Descent Step"):
|
| 75 |
grad = derivative(func_input, st.session_state.x)
|