Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,21 @@ import plotly.graph_objects as go
|
|
| 6 |
st.set_page_config(page_title="Interactive Gradient Descent Visualizer", layout="wide")
|
| 7 |
st.markdown("<h1 style='text-align: center; color: grey;'> 🌟 Gradient Descent Visualizer</h1>", unsafe_allow_html=True)
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Safe function evaluation
|
| 11 |
def evaluate_function(expression, x_value):
|
|
@@ -54,7 +69,7 @@ left_col, right_col = st.columns([1, 2]) # 1 for left, 2 for right grid proport
|
|
| 54 |
with left_col:
|
| 55 |
st.markdown("### Input Your Function")
|
| 56 |
function_input = st.text_input(
|
| 57 |
-
"Enter Function:Ex:'x**2
|
| 58 |
"x**2 + x",
|
| 59 |
key="math_function",
|
| 60 |
on_change=reset_session_state
|
|
|
|
| 6 |
st.set_page_config(page_title="Interactive Gradient Descent Visualizer", layout="wide")
|
| 7 |
st.markdown("<h1 style='text-align: center; color: grey;'> 🌟 Gradient Descent Visualizer</h1>", unsafe_allow_html=True)
|
| 8 |
|
| 9 |
+
# Custom CSS for green button color
|
| 10 |
+
st.markdown("""
|
| 11 |
+
<style>
|
| 12 |
+
.stButton>button {
|
| 13 |
+
background-color: #4CAF50; /* Green color */
|
| 14 |
+
color: white;
|
| 15 |
+
border-radius: 5px;
|
| 16 |
+
padding: 10px 20px;
|
| 17 |
+
font-size: 16px;
|
| 18 |
+
}
|
| 19 |
+
.stButton>button:hover {
|
| 20 |
+
background-color: #45a049; /* Darker green on hover */
|
| 21 |
+
}
|
| 22 |
+
</style>
|
| 23 |
+
""", unsafe_allow_html=True)
|
| 24 |
|
| 25 |
# Safe function evaluation
|
| 26 |
def evaluate_function(expression, x_value):
|
|
|
|
| 69 |
with left_col:
|
| 70 |
st.markdown("### Input Your Function")
|
| 71 |
function_input = st.text_input(
|
| 72 |
+
"Enter Function:Ex:`Ex:'x**2`,`np.sin(x)`,",
|
| 73 |
"x**2 + x",
|
| 74 |
key="math_function",
|
| 75 |
on_change=reset_session_state
|