Update app.py
Browse files
app.py
CHANGED
|
@@ -68,22 +68,27 @@ st.markdown(
|
|
| 68 |
.stButton {
|
| 69 |
margin-top: 10px;
|
| 70 |
}
|
|
|
|
| 71 |
.css-1d391kg {
|
| 72 |
padding-top: 0.5rem;
|
| 73 |
}
|
|
|
|
| 74 |
.stPlotlyChart {
|
| 75 |
display: block;
|
| 76 |
margin: 0 auto;
|
| 77 |
}
|
|
|
|
| 78 |
.css-1lcbvhc {
|
| 79 |
padding-left: 0;
|
| 80 |
padding-right: 0;
|
| 81 |
}
|
|
|
|
| 82 |
.stTextInput input, .stNumberInput input {
|
| 83 |
border: 2px solid #001A6E;
|
| 84 |
border-radius: 5px;
|
| 85 |
padding: 10px;
|
| 86 |
}
|
|
|
|
| 87 |
.tooltip {
|
| 88 |
position: relative;
|
| 89 |
display: inline-block;
|
|
@@ -100,7 +105,7 @@ st.markdown(
|
|
| 100 |
padding: 5px;
|
| 101 |
position: absolute;
|
| 102 |
z-index: 1;
|
| 103 |
-
bottom: 125%;
|
| 104 |
left: 50%;
|
| 105 |
margin-left: -150px;
|
| 106 |
transition: opacity 0.3s;
|
|
@@ -129,8 +134,11 @@ with col1:
|
|
| 129 |
<label for="func_input">Enter a function of 'x':</label>
|
| 130 |
<span class="tooltiptext">
|
| 131 |
**How to input your function:**
|
| 132 |
-
-
|
| 133 |
-
-
|
|
|
|
|
|
|
|
|
|
| 134 |
</span>
|
| 135 |
</div>
|
| 136 |
""",
|
|
@@ -152,17 +160,15 @@ with col1:
|
|
| 152 |
key="starting_point",
|
| 153 |
on_change=reset_state
|
| 154 |
)
|
| 155 |
-
|
| 156 |
"Learning Rate (ŋ)",
|
| 157 |
value=st.session_state.learning_rate,
|
| 158 |
step=0.01,
|
| 159 |
-
format="%.2f"
|
| 160 |
-
key="new_learning_rate"
|
| 161 |
)
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
st.session_state.learning_rate = learning_rate
|
| 166 |
|
| 167 |
col3, col4 = st.columns(2)
|
| 168 |
with col3:
|
|
|
|
| 68 |
.stButton {
|
| 69 |
margin-top: 10px;
|
| 70 |
}
|
| 71 |
+
/* Reduced Padding at the top */
|
| 72 |
.css-1d391kg {
|
| 73 |
padding-top: 0.5rem;
|
| 74 |
}
|
| 75 |
+
/* Centering the legend in the plot */
|
| 76 |
.stPlotlyChart {
|
| 77 |
display: block;
|
| 78 |
margin: 0 auto;
|
| 79 |
}
|
| 80 |
+
/* Adjusting for full width without scrolling */
|
| 81 |
.css-1lcbvhc {
|
| 82 |
padding-left: 0;
|
| 83 |
padding-right: 0;
|
| 84 |
}
|
| 85 |
+
/* Custom borders for input fields */
|
| 86 |
.stTextInput input, .stNumberInput input {
|
| 87 |
border: 2px solid #001A6E;
|
| 88 |
border-radius: 5px;
|
| 89 |
padding: 10px;
|
| 90 |
}
|
| 91 |
+
/* Tooltip styling */
|
| 92 |
.tooltip {
|
| 93 |
position: relative;
|
| 94 |
display: inline-block;
|
|
|
|
| 105 |
padding: 5px;
|
| 106 |
position: absolute;
|
| 107 |
z-index: 1;
|
| 108 |
+
bottom: 125%; /* Position the tooltip above */
|
| 109 |
left: 50%;
|
| 110 |
margin-left: -150px;
|
| 111 |
transition: opacity 0.3s;
|
|
|
|
| 134 |
<label for="func_input">Enter a function of 'x':</label>
|
| 135 |
<span class="tooltiptext">
|
| 136 |
**How to input your function:**
|
| 137 |
+
- Please give the inputs as mentioned below
|
| 138 |
+
- x^n as x**n,
|
| 139 |
+
- sin(x) as np.sin(x)
|
| 140 |
+
- log(x) as np.log(x),
|
| 141 |
+
- e^x or exp(x) as np.exp(x).
|
| 142 |
</span>
|
| 143 |
</div>
|
| 144 |
""",
|
|
|
|
| 160 |
key="starting_point",
|
| 161 |
on_change=reset_state
|
| 162 |
)
|
| 163 |
+
new_learning_rate = st.number_input(
|
| 164 |
"Learning Rate (ŋ)",
|
| 165 |
value=st.session_state.learning_rate,
|
| 166 |
step=0.01,
|
| 167 |
+
format="%.2f"
|
|
|
|
| 168 |
)
|
| 169 |
+
# Update the learning rate without resetting progress
|
| 170 |
+
if new_learning_rate != st.session_state.learning_rate:
|
| 171 |
+
st.session_state.learning_rate = new_learning_rate
|
|
|
|
| 172 |
|
| 173 |
col3, col4 = st.columns(2)
|
| 174 |
with col3:
|