Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,8 +52,16 @@ with left_col:
|
|
| 52 |
for i, (btn_label, func_value) in enumerate(predefined_functions.items()):
|
| 53 |
with cols[i]:
|
| 54 |
if st.button(btn_label):
|
| 55 |
-
st.session_state
|
| 56 |
reset_state()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
# Gradient Descent Parameters
|
| 59 |
st.subheader("Gradient Descent Parameters")
|
|
|
|
| 52 |
for i, (btn_label, func_value) in enumerate(predefined_functions.items()):
|
| 53 |
with cols[i]:
|
| 54 |
if st.button(btn_label):
|
| 55 |
+
st.session_state['temp_func_input'] = func_value # Store the value temporarily
|
| 56 |
reset_state()
|
| 57 |
+
|
| 58 |
+
# Sync temp_func_input with the actual func_input
|
| 59 |
+
if 'temp_func_input' in st.session_state:
|
| 60 |
+
func_input = st.text_input("Enter a function of 'x':", st.session_state['temp_func_input'], key="func_input", on_change=reset_state)
|
| 61 |
+
del st.session_state['temp_func_input'] # Clean up temporary variable
|
| 62 |
+
else:
|
| 63 |
+
func_input = st.text_input("Enter a function of 'x':", "x**2 + x", key="func_input", on_change=reset_state)
|
| 64 |
+
|
| 65 |
|
| 66 |
# Gradient Descent Parameters
|
| 67 |
st.subheader("Gradient Descent Parameters")
|