Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -178,29 +178,3 @@ with col1:
|
|
178 |
with col2:
|
179 |
#st.text_area("Metrics:", value=metrics, height=100, disabled=True)
|
180 |
st.json(st.session_state.metrics)
|
181 |
-
|
182 |
-
|
183 |
-
# Show RMSE Button
|
184 |
-
col3, col4 = st.columns([3, 4]) # For RMSE button
|
185 |
-
|
186 |
-
with col3:
|
187 |
-
if st.button("Show RMSE"):
|
188 |
-
if st.session_state.metrics: # Check if metrics exist
|
189 |
-
# Assuming compute_rmse returns a numeric value or dictionary
|
190 |
-
rmse_result = compute_rmse(list(st.session_state.metrics.values()), st.session_state.response)
|
191 |
-
|
192 |
-
# Check the type of the RMSE result and ensure it's a valid JSON object
|
193 |
-
if isinstance(rmse_result, (int, float)): # If the result is a numeric value
|
194 |
-
st.session_state.rmse = {"rmse_value": rmse_result}
|
195 |
-
elif isinstance(rmse_result, dict): # If the result is already a dictionary
|
196 |
-
st.session_state.rmse = rmse_result
|
197 |
-
else:
|
198 |
-
st.session_state.rmse = {"error": "Invalid RMSE result type"}
|
199 |
-
else:
|
200 |
-
st.session_state.rmse = {"error": "Metrics not available"}
|
201 |
-
|
202 |
-
# Display RMSE (whether metrics were calculated or not)
|
203 |
-
with col4:
|
204 |
-
# Make sure to pass a valid JSON object (dictionary or list)
|
205 |
-
if isinstance(st.session_state.rmse, dict):
|
206 |
-
st.json(st.session_state.rmse) # This should now work correctly
|
|
|
178 |
with col2:
|
179 |
#st.text_area("Metrics:", value=metrics, height=100, disabled=True)
|
180 |
st.json(st.session_state.metrics)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|