Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -35,9 +35,17 @@ def load_image_pair(index):
|
|
| 35 |
def form_callback(name, imgID, correct):
|
| 36 |
with open(RESULTS_FILE, 'a+') as f: #Append & read mode
|
| 37 |
yes = f.write(f"{name},{imgID},{correct}\n")
|
| 38 |
-
st.success(
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# -------------------------
|
| 43 |
# Navigation via st.session_state
|
|
@@ -114,13 +122,19 @@ if st.session_state.page == "evaluation":
|
|
| 114 |
|
| 115 |
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
# d = {'ID_img': st.session_state.list_pair_ID, 'Correct': correct_guess}
|
| 118 |
# df = pd.DataFrame(data=d)
|
| 119 |
# df.to_csv(st.session_state.user_name+'.csv')
|
| 120 |
|
| 121 |
-
form_callback(st.session_state.user_name, st.session_state.list_pair_ID, correct_guess)
|
| 122 |
|
| 123 |
-
|
|
|
|
| 124 |
|
| 125 |
st.write(f"Image Pair {st.session_state.current_index+1} of {NUM_PAIRS}")
|
| 126 |
|
|
|
|
| 35 |
def form_callback(name, imgID, correct):
|
| 36 |
with open(RESULTS_FILE, 'a+') as f: #Append & read mode
|
| 37 |
yes = f.write(f"{name},{imgID},{correct}\n")
|
| 38 |
+
st.success(f"{name},{imgID},{correct}\n")
|
| 39 |
|
| 40 |
+
# def form_callback(name, results_list):
|
| 41 |
+
# # On convertit la liste de dictionnaires en lignes CSV.
|
| 42 |
+
# # Par exemple, on suppose que chaque dictionnaire a des clés: pair_index, pair_order, selected.
|
| 43 |
+
# with open(RESULTS_FILE, 'a+', encoding='utf-8') as f:
|
| 44 |
+
# for res in results_list:
|
| 45 |
+
# # Vous pouvez ajuster le format de la ligne en fonction de vos besoins
|
| 46 |
+
# line = f"{name},{res['pair_index']},{res['pair_order']},{res['selected']}\n"
|
| 47 |
+
# f.write(line)
|
| 48 |
+
# st.success("Results appended successfully!")
|
| 49 |
|
| 50 |
# -------------------------
|
| 51 |
# Navigation via st.session_state
|
|
|
|
| 122 |
|
| 123 |
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
| 124 |
|
| 125 |
+
submitted = st.form_submit_button("Submit")
|
| 126 |
+
if submitted:
|
| 127 |
+
form_callback(st.session_state.user_name, st.session_state.list_pair_ID, correct_guess)
|
| 128 |
+
st.stop()
|
| 129 |
+
|
| 130 |
+
|
| 131 |
# d = {'ID_img': st.session_state.list_pair_ID, 'Correct': correct_guess}
|
| 132 |
# df = pd.DataFrame(data=d)
|
| 133 |
# df.to_csv(st.session_state.user_name+'.csv')
|
| 134 |
|
|
|
|
| 135 |
|
| 136 |
+
|
| 137 |
+
|
| 138 |
|
| 139 |
st.write(f"Image Pair {st.session_state.current_index+1} of {NUM_PAIRS}")
|
| 140 |
|