Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,8 @@ import random
|
|
| 11 |
import pandas as pd
|
| 12 |
from PIL import Image
|
| 13 |
import numpy as np
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# -------------------------
|
| 16 |
# Global parameters
|
|
@@ -134,18 +136,22 @@ if st.session_state.page == "evaluation":
|
|
| 134 |
nb_correct = np.sum(correct_guess)
|
| 135 |
|
| 136 |
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
-
form_callback(st.session_state.user_name, st.session_state.list_pair_ID, correct_guess)
|
| 139 |
st.stop()
|
| 140 |
|
| 141 |
|
| 142 |
-
# d = {'ID_img': st.session_state.list_pair_ID, 'Correct': correct_guess}
|
| 143 |
-
# df = pd.DataFrame(data=d)
|
| 144 |
-
# df.to_csv(st.session_state.user_name+'.csv')
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
|
| 150 |
st.write(f"Image Pair {st.session_state.current_index+1} of {NUM_PAIRS}")
|
| 151 |
|
|
|
|
| 11 |
import pandas as pd
|
| 12 |
from PIL import Image
|
| 13 |
import numpy as np
|
| 14 |
+
import gspread
|
| 15 |
+
from oauth2client.service_account import ServiceAccountCredentials
|
| 16 |
|
| 17 |
# -------------------------
|
| 18 |
# Global parameters
|
|
|
|
| 136 |
nb_correct = np.sum(correct_guess)
|
| 137 |
|
| 138 |
st.success(f"Number of correct answers: {nb_correct}/{NUM_PAIRS}")
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
|
| 142 |
+
|
| 143 |
+
creds = ServiceAccountCredentials.from_json_keyfile_name('glass-flux-456209-d4-6fc4b7d9d274.json', scope)
|
| 144 |
+
client = gspread.authorize(creds)
|
| 145 |
+
|
| 146 |
+
sh = client.open('Results_woodAI').worksheet('test')
|
| 147 |
+
row = f"{st.session_state.user_name},{confidence},{st.session_state.list_pair_ID},{correct_guess}\n"
|
| 148 |
+
sh.append_row(row)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
|
|
|
|
| 152 |
st.stop()
|
| 153 |
|
| 154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
st.write(f"Image Pair {st.session_state.current_index+1} of {NUM_PAIRS}")
|
| 157 |
|