Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -149,12 +149,12 @@ st.subheader("Response")
|
|
149 |
st.text_area("Generated Response:", value=st.session_state.response, height=150, disabled=True)
|
150 |
|
151 |
col1, col2 = st.columns([1, 3]) # Creating two columns for button and metrics display
|
152 |
-
|
153 |
|
154 |
|
155 |
|
156 |
# Display RMSE
|
157 |
-
st.json(st.session_state.rmse)
|
158 |
|
159 |
# # Calculate Metrics Button
|
160 |
# with col1:
|
@@ -178,21 +178,16 @@ with col1:
|
|
178 |
with col2:
|
179 |
#st.text_area("Metrics:", value=metrics, height=100, disabled=True)
|
180 |
st.json(st.session_state.metrics)
|
|
|
|
|
181 |
# Show RMSE Button
|
182 |
with col3:
|
183 |
if st.button("Show RMSE"):
|
184 |
if st.session_state.metrics: # Check if metrics exist
|
185 |
# Assuming compute_rmse returns a numeric value or dictionary
|
186 |
st.session_state.rmse = compute_rmse(st.session_state.metrics.values(), st.session_state.response)
|
187 |
-
|
188 |
-
|
189 |
-
if isinstance(st.session_state.rmse, (dict, list, int, float)):
|
190 |
-
st.json({"rmse": st.session_state.rmse}) # Pass the RMSE as part of a valid JSON
|
191 |
-
else:
|
192 |
-
st.json({"error": "Invalid RMSE format"}) # Error in case RMSE is not valid
|
193 |
-
else:
|
194 |
-
st.session_state.rmse = "Metrics not available"
|
195 |
-
st.json({"error": "Metrics not available"})
|
196 |
|
197 |
# Display RMSE (whether metrics were calculated or not)
|
198 |
with col4:
|
|
|
149 |
st.text_area("Generated Response:", value=st.session_state.response, height=150, disabled=True)
|
150 |
|
151 |
col1, col2 = st.columns([1, 3]) # Creating two columns for button and metrics display
|
152 |
+
|
153 |
|
154 |
|
155 |
|
156 |
# Display RMSE
|
157 |
+
#st.json(st.session_state.rmse)
|
158 |
|
159 |
# # Calculate Metrics Button
|
160 |
# 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 |
+
col3, col4 =st.columns([3, 4]) #for RMSE button
|
183 |
# Show RMSE Button
|
184 |
with col3:
|
185 |
if st.button("Show RMSE"):
|
186 |
if st.session_state.metrics: # Check if metrics exist
|
187 |
# Assuming compute_rmse returns a numeric value or dictionary
|
188 |
st.session_state.rmse = compute_rmse(st.session_state.metrics.values(), st.session_state.response)
|
189 |
+
else:
|
190 |
+
st.session_state.rmse = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
# Display RMSE (whether metrics were calculated or not)
|
193 |
with col4:
|