Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ import numpy as np
|
|
| 16 |
# Global parameters
|
| 17 |
# -------------------------
|
| 18 |
IMAGE_DIR = "images" # Dossier contenant les images
|
| 19 |
-
NUM_PAIRS =
|
| 20 |
RESULTS_FILE = "results.csv" # Fichier CSV de sauvegarde des réponses
|
| 21 |
|
| 22 |
# -------------------------
|
|
@@ -58,6 +58,7 @@ if "current_index" not in st.session_state:
|
|
| 58 |
st.session_state.current_index = 1
|
| 59 |
if "results" not in st.session_state:
|
| 60 |
st.session_state.results = []
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
|
|
@@ -96,16 +97,16 @@ if st.session_state.page == "evaluation":
|
|
| 96 |
# If all pairs have been evaluated, display a message and save the results
|
| 97 |
if st.session_state.current_index > NUM_PAIRS:
|
| 98 |
st.success("Thank you for completing the evaluation!")
|
| 99 |
-
results_df = pd.DataFrame(st.session_state.results)
|
| 100 |
-
results_df.to_csv(RESULTS_FILE, index=False)
|
| 101 |
-
|
| 102 |
|
| 103 |
#Calculating result
|
| 104 |
-
correct_guess = np.array(st.session_state.results
|
| 105 |
|
| 106 |
nb_correct = np.sum(correct_guess)
|
| 107 |
|
| 108 |
-
st.success(f"Number of correct answers: {nb_correct}/
|
| 109 |
|
| 110 |
st.stop()
|
| 111 |
|
|
@@ -125,17 +126,14 @@ if st.session_state.page == "evaluation":
|
|
| 125 |
choice = st.radio("", options=["1 ", "2"], index=0, horizontal = True)
|
| 126 |
|
| 127 |
|
| 128 |
-
if st.button("
|
| 129 |
|
| 130 |
if (choice == "1 " and pair[0][0] == "GT") or (choice == "2" and pair[1][0] == "GT"):
|
| 131 |
correct_guess = 1
|
| 132 |
else:
|
| 133 |
correct_guess = 0
|
| 134 |
|
| 135 |
-
st.session_state.results.append(
|
| 136 |
-
"pair_index": st.session_state.current_index,
|
| 137 |
-
"correct_guess": correct_guess
|
| 138 |
-
})
|
| 139 |
|
| 140 |
# Passer à la paire suivante
|
| 141 |
st.session_state.current_index += 1
|
|
|
|
| 16 |
# Global parameters
|
| 17 |
# -------------------------
|
| 18 |
IMAGE_DIR = "images" # Dossier contenant les images
|
| 19 |
+
NUM_PAIRS = 10 # Nombre total de paires à évaluer
|
| 20 |
RESULTS_FILE = "results.csv" # Fichier CSV de sauvegarde des réponses
|
| 21 |
|
| 22 |
# -------------------------
|
|
|
|
| 58 |
st.session_state.current_index = 1
|
| 59 |
if "results" not in st.session_state:
|
| 60 |
st.session_state.results = []
|
| 61 |
+
|
| 62 |
|
| 63 |
|
| 64 |
|
|
|
|
| 97 |
# If all pairs have been evaluated, display a message and save the results
|
| 98 |
if st.session_state.current_index > NUM_PAIRS:
|
| 99 |
st.success("Thank you for completing the evaluation!")
|
| 100 |
+
# results_df = pd.DataFrame(st.session_state.results)
|
| 101 |
+
# results_df.to_csv(RESULTS_FILE, index=False)
|
| 102 |
+
|
| 103 |
|
| 104 |
#Calculating result
|
| 105 |
+
correct_guess = np.array(st.session_state.results)
|
| 106 |
|
| 107 |
nb_correct = np.sum(correct_guess)
|
| 108 |
|
| 109 |
+
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
| 110 |
|
| 111 |
st.stop()
|
| 112 |
|
|
|
|
| 126 |
choice = st.radio("", options=["1 ", "2"], index=0, horizontal = True)
|
| 127 |
|
| 128 |
|
| 129 |
+
if st.button("Next"):
|
| 130 |
|
| 131 |
if (choice == "1 " and pair[0][0] == "GT") or (choice == "2" and pair[1][0] == "GT"):
|
| 132 |
correct_guess = 1
|
| 133 |
else:
|
| 134 |
correct_guess = 0
|
| 135 |
|
| 136 |
+
st.session_state.results.append(correct_guess)
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
# Passer à la paire suivante
|
| 139 |
st.session_state.current_index += 1
|