Nolwenn
commited on
Commit
·
0c71ade
1
Parent(s):
4f5b924
Add style for loading spinner
Browse files- crs_arena/arena.py +24 -10
crs_arena/arena.py
CHANGED
@@ -6,10 +6,10 @@ All the conversations are recorded and saved for future analysis. When the user
|
|
6 |
arrives on the app, they are assigned a unique ID. Then, two CRSs are chosen
|
7 |
for the battle depending on the number of conversations already recorded (i.e.,
|
8 |
the CRSs with the least number of conversations are chosen). The user interacts
|
9 |
-
with the CRSs one after the other. The user can then vote on which CRS they
|
10 |
-
upon voting a pop-up will appear giving the user the option to provide
|
11 |
-
detailed feedback. Once the vote is submitted, all data is logged and
|
12 |
-
restarts for a new battle.
|
13 |
|
14 |
The app is composed of four sections:
|
15 |
1. Title/Introduction
|
@@ -68,7 +68,8 @@ def record_vote(vote: str) -> None:
|
|
68 |
crs2_model: CRSFighter = st.session_state["crs2"]
|
69 |
last_row_id = str(datetime.now())
|
70 |
logger.info(
|
71 |
-
f"Vote: {last_row_id}, {user_id}, {crs1_model.name}, {crs2_model.name}
|
|
|
72 |
)
|
73 |
asyncio.run(
|
74 |
upload_feedback_to_gsheet(
|
@@ -272,6 +273,19 @@ def chat_col(crs_id: int, color: str):
|
|
272 |
# Streamlit app
|
273 |
st.set_page_config(page_title="CRS Arena", layout="wide")
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
# Cache some CRS fighters at startup
|
276 |
cache_fighters()
|
277 |
|
@@ -294,8 +308,8 @@ st.write(
|
|
294 |
"* Chat with each CRS (one after the other) to get **movie recommendations** "
|
295 |
"up until you feel statisfied or frustrated.\n"
|
296 |
"* Please be patient as some CRSs may take a few seconds to respond.\n"
|
297 |
-
"* Try to send several messages to each CRS to get a better sense of their
|
298 |
-
"capabilities. Don't quit after the first message!\n"
|
299 |
"* To finish chatting with a CRS, click on the button corresponding to "
|
300 |
"your feeling: frustrated or satisfied.\n"
|
301 |
"* Vote on which CRS you prefer or declare a tie.\n"
|
@@ -363,11 +377,11 @@ container_col3.button(
|
|
363 |
# Terms of service
|
364 |
st.header("Terms of Service")
|
365 |
st.write(
|
366 |
-
"By using this application, you agree to the following terms of service
|
367 |
"The service is a research platform. It may produce offensive content. "
|
368 |
"Please do not upload any private information in the chat. The service "
|
369 |
-
"collects the chat data and the user's vote, which may be released under a
|
370 |
-
"Creative Commons Attribution (CC-BY) or a similar license."
|
371 |
)
|
372 |
|
373 |
# Contact information
|
|
|
6 |
arrives on the app, they are assigned a unique ID. Then, two CRSs are chosen
|
7 |
for the battle depending on the number of conversations already recorded (i.e.,
|
8 |
the CRSs with the least number of conversations are chosen). The user interacts
|
9 |
+
with the CRSs one after the other. The user can then vote on which CRS they
|
10 |
+
prefer, upon voting a pop-up will appear giving the user the option to provide
|
11 |
+
a more detailed feedback. Once the vote is submitted, all data is logged and
|
12 |
+
the app restarts for a new battle.
|
13 |
|
14 |
The app is composed of four sections:
|
15 |
1. Title/Introduction
|
|
|
68 |
crs2_model: CRSFighter = st.session_state["crs2"]
|
69 |
last_row_id = str(datetime.now())
|
70 |
logger.info(
|
71 |
+
f"Vote: {last_row_id}, {user_id}, {crs1_model.name}, {crs2_model.name}"
|
72 |
+
f", {vote}"
|
73 |
)
|
74 |
asyncio.run(
|
75 |
upload_feedback_to_gsheet(
|
|
|
273 |
# Streamlit app
|
274 |
st.set_page_config(page_title="CRS Arena", layout="wide")
|
275 |
|
276 |
+
# Add style for spinner
|
277 |
+
st.markdown(
|
278 |
+
"""<style>
|
279 |
+
.stSpinner {
|
280 |
+
font-size: 2em;
|
281 |
+
display: flex;
|
282 |
+
justify-content: center;
|
283 |
+
align-items: center;
|
284 |
+
}
|
285 |
+
</style>
|
286 |
+
""",
|
287 |
+
unsafe_allow_html=True,
|
288 |
+
)
|
289 |
# Cache some CRS fighters at startup
|
290 |
cache_fighters()
|
291 |
|
|
|
308 |
"* Chat with each CRS (one after the other) to get **movie recommendations** "
|
309 |
"up until you feel statisfied or frustrated.\n"
|
310 |
"* Please be patient as some CRSs may take a few seconds to respond.\n"
|
311 |
+
"* Try to send several messages to each CRS to get a better sense of their"
|
312 |
+
" capabilities. Don't quit after the first message!\n"
|
313 |
"* To finish chatting with a CRS, click on the button corresponding to "
|
314 |
"your feeling: frustrated or satisfied.\n"
|
315 |
"* Vote on which CRS you prefer or declare a tie.\n"
|
|
|
377 |
# Terms of service
|
378 |
st.header("Terms of Service")
|
379 |
st.write(
|
380 |
+
"By using this application, you agree to the following terms of service:\n"
|
381 |
"The service is a research platform. It may produce offensive content. "
|
382 |
"Please do not upload any private information in the chat. The service "
|
383 |
+
"collects the chat data and the user's vote, which may be released under a"
|
384 |
+
" Creative Commons Attribution (CC-BY) or a similar license."
|
385 |
)
|
386 |
|
387 |
# Contact information
|