Update app.py
Browse files
app.py
CHANGED
|
@@ -102,14 +102,7 @@ col1, col2 = st.columns([1, 2])
|
|
| 102 |
with col1:
|
| 103 |
st.subheader("🔧 Define Your Function")
|
| 104 |
|
| 105 |
-
#
|
| 106 |
-
func_input = st.text_input(
|
| 107 |
-
"Enter a function of 'x':",
|
| 108 |
-
st.session_state.func_input,
|
| 109 |
-
key="func_input",
|
| 110 |
-
on_change=reset_state
|
| 111 |
-
)
|
| 112 |
-
|
| 113 |
st.write("Or choose a predefined function:")
|
| 114 |
cols = st.columns(4)
|
| 115 |
for i, (btn_label, func_value) in enumerate(predefined_functions.items()):
|
|
@@ -119,6 +112,14 @@ with col1:
|
|
| 119 |
reset_state() # Ensure that the reset function is called to update the state
|
| 120 |
st.experimental_rerun() # Re-run to ensure everything updates properly
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
st.subheader("⚙️ Gradient Descent Parameters")
|
| 123 |
starting_point = st.number_input(
|
| 124 |
"Starting Point (X₀)",
|
|
|
|
| 102 |
with col1:
|
| 103 |
st.subheader("🔧 Define Your Function")
|
| 104 |
|
| 105 |
+
# Display the predefined function buttons
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
st.write("Or choose a predefined function:")
|
| 107 |
cols = st.columns(4)
|
| 108 |
for i, (btn_label, func_value) in enumerate(predefined_functions.items()):
|
|
|
|
| 112 |
reset_state() # Ensure that the reset function is called to update the state
|
| 113 |
st.experimental_rerun() # Re-run to ensure everything updates properly
|
| 114 |
|
| 115 |
+
# Use text input for the user to define a function
|
| 116 |
+
func_input = st.text_input(
|
| 117 |
+
"Enter a function of 'x':",
|
| 118 |
+
st.session_state.func_input,
|
| 119 |
+
key="func_input",
|
| 120 |
+
on_change=reset_state
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
st.subheader("⚙️ Gradient Descent Parameters")
|
| 124 |
starting_point = st.number_input(
|
| 125 |
"Starting Point (X₀)",
|