CarolineM5 commited on
Commit
a7969be
·
verified ·
1 Parent(s): 9a07d15

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -30
app.py CHANGED
@@ -193,10 +193,10 @@ if st.session_state.page == "evaluation":
193
  # st.session_state.page = "detailed_results"
194
  # st.rerun()
195
 
196
- # if st.session_state.submitted == True:
197
- # if st.button("See detailed results"):
198
- # st.session_state.page = "detailed_results"
199
- # st.rerun()
200
  # st.stop()
201
 
202
  st.stop()
@@ -259,32 +259,34 @@ if st.session_state.page == "evaluation":
259
  st.rerun()
260
 
261
 
262
- # if st.session_state.page == "detailed_results":
263
- # st.title("Detailed Results")
264
-
265
- # for i, (pair, result) in enumerate(zip(st.session_state.list_pair_ID, st.session_state.results)):
266
- # st.markdown(f"### Pair {i+1}")
267
-
268
- # col1, col2 = st.columns(2)
269
- # with col1:
270
- # st.image(pair[0][1], caption=f"Image 1 ({pair[0][0]})", use_container_width=True)
271
- # with col2:
272
- # st.image(pair[1][1], caption=f"Image 2 ({pair[1][0]})", use_container_width=True)
273
 
274
- # # Trouver la vraie image
275
- # real_index = 0 if pair[0][0] == "GT" else 1
276
- # user_choice_index = 0 if result == 1 else 1 # on suppose que la prédiction est correcte si result==1
277
-
278
- # # Afficher les infos
279
- # st.write(f"**Real image:** Image {real_index+1}")
280
- # st.write(f"**Your choice:** Image {user_choice_index+1}")
281
 
282
- # if result:
283
- # st.success("✅ Correct")
284
- # else:
285
- # st.error("❌ Incorrect")
 
 
 
 
 
 
286
 
287
- # st.markdown("---")
288
-
289
-
290
-
 
 
 
 
 
 
 
 
 
 
193
  # st.session_state.page = "detailed_results"
194
  # st.rerun()
195
 
196
+ if st.session_state.submitted == True:
197
+ if st.button("See detailed results"):
198
+ st.session_state.page = "detailed_results"
199
+ st.rerun()
200
  # st.stop()
201
 
202
  st.stop()
 
259
  st.rerun()
260
 
261
 
262
+ if st.session_state.page == "detailed_results":
263
+ st.title("Detailed Results")
264
+ results = np.array(st.session_state.results)
 
 
 
 
 
 
 
 
265
 
266
+ for i in range(NUM_PAIRS):
267
+ pair = st.session_state.list_pair[i]
 
 
 
 
 
268
 
269
+ if pair[0][0] == "GT":
270
+ imgGT = Image.open(pair[0][1])
271
+ imgGT = imgGT.convert("L")
272
+ imgPred = Image.open(pair[1][1])
273
+ imgPred = imgPred.convert("L")
274
+ else:
275
+ imgGT = Image.open(pair[1][1])
276
+ imgGT = imgGT.convert("L")
277
+ imgPred = Image.open(pair[0][1])
278
+ imgPred = imgPred.convert("L")
279
 
280
+ col1, col2 = st.columns(2)
281
+ with col1:
282
+ st.image(imgGT, caption="Real", use_container_width=True)
283
+ with col2:
284
+ st.image(imgPred, caption="AI", use_container_width=True)
285
+
286
+ result = results[i]
287
+
288
+ if result:
289
+ st.success("✅ Correct")
290
+ else:
291
+ st.error("❌ Incorrect")
292
+ st.markdown("---")