Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,8 @@ if "list_pair" not in st.session_state:
|
|
| 85 |
st.session_state.list_pair = []
|
| 86 |
if "list_pair_ID" not in st.session_state:
|
| 87 |
st.session_state.list_pair_ID = []
|
| 88 |
-
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
# -------------------------
|
|
@@ -173,6 +174,7 @@ if st.session_state.page == "evaluation":
|
|
| 173 |
#Calculating result
|
| 174 |
correct_guess = np.array(st.session_state.results)
|
| 175 |
nb_correct = np.sum(correct_guess)
|
|
|
|
| 176 |
|
| 177 |
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
| 178 |
st.success("Thank you for completing the evaluation!", icon=":material/park:")
|
|
@@ -196,8 +198,13 @@ if st.session_state.page == "evaluation":
|
|
| 196 |
sh.append_row(row)
|
| 197 |
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
-
|
| 201 |
|
| 202 |
|
| 203 |
st_autorefresh(interval=1000, key=f"timer_{st.session_state.current_index}")
|
|
@@ -257,7 +264,34 @@ if st.session_state.page == "evaluation":
|
|
| 257 |
st.rerun()
|
| 258 |
|
| 259 |
|
|
|
|
|
|
|
| 260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
|
|
|
|
|
|
|
| 262 |
|
| 263 |
|
|
|
|
| 85 |
st.session_state.list_pair = []
|
| 86 |
if "list_pair_ID" not in st.session_state:
|
| 87 |
st.session_state.list_pair_ID = []
|
| 88 |
+
if "results_tot" not in st.session_state:
|
| 89 |
+
st.session_state.results_tot = 0
|
| 90 |
|
| 91 |
|
| 92 |
# -------------------------
|
|
|
|
| 174 |
#Calculating result
|
| 175 |
correct_guess = np.array(st.session_state.results)
|
| 176 |
nb_correct = np.sum(correct_guess)
|
| 177 |
+
st.session_state.results_tot = nb_correct
|
| 178 |
|
| 179 |
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
| 180 |
st.success("Thank you for completing the evaluation!", icon=":material/park:")
|
|
|
|
| 198 |
sh.append_row(row)
|
| 199 |
|
| 200 |
|
| 201 |
+
if st.button("See detailed results"):
|
| 202 |
+
st.session_state.page = "detailed_results"
|
| 203 |
+
st.rerun()
|
| 204 |
+
|
| 205 |
+
|
| 206 |
|
| 207 |
+
|
| 208 |
|
| 209 |
|
| 210 |
st_autorefresh(interval=1000, key=f"timer_{st.session_state.current_index}")
|
|
|
|
| 264 |
st.rerun()
|
| 265 |
|
| 266 |
|
| 267 |
+
if st.session_state.page == "detailed_results":
|
| 268 |
+
st.title("Detailed Results")
|
| 269 |
|
| 270 |
+
for i, (pair, result) in enumerate(zip(st.session_state.list_pair_ID, st.session_state.results)):
|
| 271 |
+
st.markdown(f"### Pair {i+1}")
|
| 272 |
+
|
| 273 |
+
col1, col2 = st.columns(2)
|
| 274 |
+
with col1:
|
| 275 |
+
st.image(pair[0][1], caption=f"Image 1 ({pair[0][0]})", use_container_width=True)
|
| 276 |
+
with col2:
|
| 277 |
+
st.image(pair[1][1], caption=f"Image 2 ({pair[1][0]})", use_container_width=True)
|
| 278 |
+
|
| 279 |
+
# Trouver la vraie image
|
| 280 |
+
real_index = 0 if pair[0][0] == "GT" else 1
|
| 281 |
+
user_choice_index = 0 if result == 1 else 1 # on suppose que la prédiction est correcte si result==1
|
| 282 |
+
|
| 283 |
+
# Afficher les infos
|
| 284 |
+
st.write(f"**Real image:** Image {real_index+1}")
|
| 285 |
+
st.write(f"**Your choice:** Image {user_choice_index+1}")
|
| 286 |
+
|
| 287 |
+
if result:
|
| 288 |
+
st.success("✅ Correct")
|
| 289 |
+
else:
|
| 290 |
+
st.error("❌ Incorrect")
|
| 291 |
+
|
| 292 |
+
st.markdown("---")
|
| 293 |
|
| 294 |
+
|
| 295 |
+
st.stop()
|
| 296 |
|
| 297 |
|