Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,10 +97,10 @@ with col1:
|
|
| 97 |
start_point = st.number_input("Starting Point (x):", value=4.0, step=0.1, format="%.2f", key="start_point", on_change=reset_session)
|
| 98 |
learning_rate = st.number_input("Learning Rate:", value=0.1, step=0.01, format="%.2f", key="learning_rate", on_change=reset_session)
|
| 99 |
|
| 100 |
-
# Buttons for actions with styling
|
| 101 |
-
col1.button("π Next Step", key="
|
| 102 |
col1.button("π Reset", key="reset", use_container_width=True, help="Reset the gradient descent", on_click=reset_session)
|
| 103 |
-
iteration_data_button = col1.button("π Iteration Data", key="
|
| 104 |
|
| 105 |
# Right column for visualization
|
| 106 |
with col2:
|
|
@@ -144,7 +144,7 @@ with col2:
|
|
| 144 |
st.plotly_chart(plot)
|
| 145 |
|
| 146 |
# Perform gradient descent operation when button is clicked
|
| 147 |
-
if st.button("π Next Step", key="
|
| 148 |
try:
|
| 149 |
grad = compute_derivative(st.session_state.func_input, st.session_state.x_current)
|
| 150 |
st.session_state.x_current = st.session_state.x_current - st.session_state.learning_rate * grad
|
|
|
|
| 97 |
start_point = st.number_input("Starting Point (x):", value=4.0, step=0.1, format="%.2f", key="start_point", on_change=reset_session)
|
| 98 |
learning_rate = st.number_input("Learning Rate:", value=0.1, step=0.01, format="%.2f", key="learning_rate", on_change=reset_session)
|
| 99 |
|
| 100 |
+
# Buttons for actions with styling (change key to make it unique)
|
| 101 |
+
col1.button("π Next Step", key="next_step", use_container_width=True, help="Perform one step of gradient descent", on_click=None)
|
| 102 |
col1.button("π Reset", key="reset", use_container_width=True, help="Reset the gradient descent", on_click=reset_session)
|
| 103 |
+
iteration_data_button = col1.button("π Iteration Data", key="iteration_data_button", use_container_width=True)
|
| 104 |
|
| 105 |
# Right column for visualization
|
| 106 |
with col2:
|
|
|
|
| 144 |
st.plotly_chart(plot)
|
| 145 |
|
| 146 |
# Perform gradient descent operation when button is clicked
|
| 147 |
+
if st.button("π Next Step", key="next_step", use_container_width=True):
|
| 148 |
try:
|
| 149 |
grad = compute_derivative(st.session_state.func_input, st.session_state.x_current)
|
| 150 |
st.session_state.x_current = st.session_state.x_current - st.session_state.learning_rate * grad
|