Spaces:
Sleeping
Sleeping
Ashmi Banerjee
commited on
Commit
·
dd3763f
1
Parent(s):
4f7c053
broken state management but otherwise pretty
Browse files- README.md +2 -1
- db/crud.py +1 -37
- run_crud.py +52 -2
- utils/notebooks/Data Merging.ipynb +49 -49
- views/intro_screen.py +5 -1
- views/nav_buttons.py +2 -1
- views/questions_screen.py +4 -1
README.md
CHANGED
|
@@ -25,8 +25,9 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 25 |
[x] Implement save and continue later button
|
| 26 |
[x] Implement questions with proper buttons (with text)
|
| 27 |
[ ] Back button
|
|
|
|
| 28 |
[x] Dataset linking HF
|
| 29 |
[x] prettify the context field with new lines and highlighting popularity etc. keywords in bold
|
| 30 |
[x] Doing it for two models - combine datasets
|
| 31 |
[ ] Add check for ratings should not be 0 for Exit & Resume Later
|
| 32 |
-
[
|
|
|
|
| 25 |
[x] Implement save and continue later button
|
| 26 |
[x] Implement questions with proper buttons (with text)
|
| 27 |
[ ] Back button
|
| 28 |
+
[ ] Next button + overall state management
|
| 29 |
[x] Dataset linking HF
|
| 30 |
[x] prettify the context field with new lines and highlighting popularity etc. keywords in bold
|
| 31 |
[x] Doing it for two models - combine datasets
|
| 32 |
[ ] Add check for ratings should not be 0 for Exit & Resume Later
|
| 33 |
+
[x] Check the firebase DB rules
|
db/crud.py
CHANGED
|
@@ -87,40 +87,4 @@ def reset_feedback_in_db(user_id: str):
|
|
| 87 |
print(f"Feedback data for user '{user_id}' reset in Firebase.")
|
| 88 |
|
| 89 |
|
| 90 |
-
|
| 91 |
-
# Create a feedback object
|
| 92 |
-
# feedback = Feedback(
|
| 93 |
-
# id=2,
|
| 94 |
-
# user_id='tt',
|
| 95 |
-
# time_stamp=datetime(2025, 1, 30, 21, 25, 15, 581994),
|
| 96 |
-
# responses=[
|
| 97 |
-
# Response(config_id='c_p_0_pop_low_easy', rating_v=1, rating_p0=1, rating_p1=1, comment='',
|
| 98 |
-
# timestamp='2025-01-30T21:25:12.642038'),
|
| 99 |
-
# Response(config_id='c_p_1_pop_medium_medium', rating_v=1, rating_p0=1, rating_p1=1, comment='',
|
| 100 |
-
# timestamp='2025-01-30T21:25:13.854227'),
|
| 101 |
-
# Response(config_id='c_p_2_pop_high_hard', rating_v=1, rating_p0=1, rating_p1=1, comment='',
|
| 102 |
-
# timestamp='2025-01-30T21:25:15.581948'),
|
| 103 |
-
# ]
|
| 104 |
-
# )
|
| 105 |
-
# # Create (Ingest)
|
| 106 |
-
# ingest(feedback)
|
| 107 |
-
|
| 108 |
-
# Read (Fetch)
|
| 109 |
-
feedback_data = read("cdSf")
|
| 110 |
-
if feedback_data:
|
| 111 |
-
print(feedback_data)
|
| 112 |
-
|
| 113 |
-
# Update (Modify)
|
| 114 |
-
# updated_feedback = Feedback(
|
| 115 |
-
# id=1,
|
| 116 |
-
# user_id="user123",
|
| 117 |
-
# time_stamp=datetime.now(),
|
| 118 |
-
# responses=[
|
| 119 |
-
# {"q_id": "q1", "ans": 4}, # Updated answer
|
| 120 |
-
# {"q_id": "q2", "ans": 3}
|
| 121 |
-
# ]
|
| 122 |
-
# )
|
| 123 |
-
# update(1, updated_feedback)
|
| 124 |
-
#
|
| 125 |
-
# # Delete (Remove)
|
| 126 |
-
# delete(1)
|
|
|
|
| 87 |
print(f"Feedback data for user '{user_id}' reset in Firebase.")
|
| 88 |
|
| 89 |
|
| 90 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
run_crud.py
CHANGED
|
@@ -1,5 +1,55 @@
|
|
| 1 |
-
from db.crud import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
if __name__ == "__main__":
|
| 4 |
test()
|
| 5 |
-
|
|
|
|
| 1 |
+
from db.crud import ingest, read, update, delete
|
| 2 |
+
from db.schema import Feedback, Response, ModelRatings
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def test():
|
| 7 |
+
# Sample data for ModelRatings
|
| 8 |
+
model_ratings = ModelRatings(
|
| 9 |
+
query_v_ratings={'v1': 5, 'v2': 4},
|
| 10 |
+
query_p0_ratings={'p0_1': 3, 'p0_2': 4},
|
| 11 |
+
query_p1_ratings={'p1_1': 2, 'p1_2': 5}
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
# Sample data for Response
|
| 15 |
+
response = Response(
|
| 16 |
+
config_id='config_123',
|
| 17 |
+
model_ratings={'model_1': model_ratings},
|
| 18 |
+
comment='This is a sample response.',
|
| 19 |
+
timestamp='2025-02-01T18:13:48'
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Sample data for Feedback
|
| 23 |
+
feedback = Feedback(
|
| 24 |
+
id=1,
|
| 25 |
+
user_id='user_123',
|
| 26 |
+
time_stamp=datetime(2025, 2, 1, 18, 13, 48),
|
| 27 |
+
responses=[response]
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
ingest(feedback)
|
| 31 |
+
print(read("user_123"))
|
| 32 |
+
|
| 33 |
+
# Read (Fetch)
|
| 34 |
+
feedback_data = read("ashmi")
|
| 35 |
+
if feedback_data:
|
| 36 |
+
print(feedback_data)
|
| 37 |
+
|
| 38 |
+
# Update (Modify)
|
| 39 |
+
# updated_feedback = Feedback(
|
| 40 |
+
# id=1,
|
| 41 |
+
# user_id="user123",
|
| 42 |
+
# time_stamp=datetime.now(),
|
| 43 |
+
# responses=[
|
| 44 |
+
# {"q_id": "q1", "ans": 4}, # Updated answer
|
| 45 |
+
# {"q_id": "q2", "ans": 3}
|
| 46 |
+
# ]
|
| 47 |
+
# )
|
| 48 |
+
# update(1, updated_feedback)
|
| 49 |
+
#
|
| 50 |
+
# # Delete (Remove)
|
| 51 |
+
# delete(1)
|
| 52 |
+
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
| 55 |
test()
|
|
|
utils/notebooks/Data Merging.ipynb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
-
"execution_count":
|
| 6 |
-
"id": "
|
| 7 |
"metadata": {},
|
| 8 |
"outputs": [],
|
| 9 |
"source": [
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
},
|
| 13 |
{
|
| 14 |
"cell_type": "code",
|
| 15 |
-
"execution_count":
|
| 16 |
-
"id": "
|
| 17 |
"metadata": {},
|
| 18 |
"outputs": [
|
| 19 |
{
|
|
@@ -66,7 +66,7 @@
|
|
| 66 |
" <td>['Adana', 'Adiyaman', 'Agri', 'Arad', 'Arkhang...</td>\n",
|
| 67 |
" <td>\"Less crowded European cities to visit in Febr...</td>\n",
|
| 68 |
" <td>\"European cities with ice hockey facilities, l...</td>\n",
|
| 69 |
-
" <td>
|
| 70 |
" </tr>\n",
|
| 71 |
" <tr>\n",
|
| 72 |
" <th>1</th>\n",
|
|
@@ -78,7 +78,7 @@
|
|
| 78 |
" <td>['Coimbra', 'Brno', 'Braga']</td>\n",
|
| 79 |
" <td>'medium budget European city breaks with parks...</td>\n",
|
| 80 |
" <td>\"Medium budget European cities with parks and ...</td>\n",
|
| 81 |
-
" <td>
|
| 82 |
" </tr>\n",
|
| 83 |
" <tr>\n",
|
| 84 |
" <th>2</th>\n",
|
|
@@ -90,7 +90,7 @@
|
|
| 90 |
" <td>['Zagreb', 'Volgograd', 'Tirana', 'Tbilisi', '...</td>\n",
|
| 91 |
" <td>\"Looking for a popular and affordable European...</td>\n",
|
| 92 |
" <td>\"Low-budget European cities with museums and n...</td>\n",
|
| 93 |
-
" <td>
|
| 94 |
" </tr>\n",
|
| 95 |
" <tr>\n",
|
| 96 |
" <th>3</th>\n",
|
|
@@ -102,7 +102,7 @@
|
|
| 102 |
" <td>['Van', 'Uzhhorod', 'Trabzon', 'Thessaloniki',...</td>\n",
|
| 103 |
" <td>\"European cities with low popularity, monaster...</td>\n",
|
| 104 |
" <td>\"off the beaten path European city breaks in l...</td>\n",
|
| 105 |
-
" <td>
|
| 106 |
" </tr>\n",
|
| 107 |
" <tr>\n",
|
| 108 |
" <th>4</th>\n",
|
|
@@ -114,7 +114,7 @@
|
|
| 114 |
" <td>['Aalborg', 'Astrakhan', 'Bari', 'Bremen', 'Ch...</td>\n",
|
| 115 |
" <td>\"European cities for a luxurious trip.\"</td>\n",
|
| 116 |
" <td>\"European cities with horse riding trails and ...</td>\n",
|
| 117 |
-
" <td>
|
| 118 |
" </tr>\n",
|
| 119 |
" </tbody>\n",
|
| 120 |
"</table>\n",
|
|
@@ -171,14 +171,14 @@
|
|
| 171 |
"4 \"European cities with horse riding trails and ... \n",
|
| 172 |
"\n",
|
| 173 |
" llama_query_p1 \n",
|
| 174 |
-
"0
|
| 175 |
-
"1
|
| 176 |
-
"2
|
| 177 |
-
"3
|
| 178 |
-
"4
|
| 179 |
]
|
| 180 |
},
|
| 181 |
-
"execution_count":
|
| 182 |
"metadata": {},
|
| 183 |
"output_type": "execute_result"
|
| 184 |
}
|
|
@@ -195,8 +195,8 @@
|
|
| 195 |
},
|
| 196 |
{
|
| 197 |
"cell_type": "code",
|
| 198 |
-
"execution_count":
|
| 199 |
-
"id": "
|
| 200 |
"metadata": {},
|
| 201 |
"outputs": [
|
| 202 |
{
|
|
@@ -361,7 +361,7 @@
|
|
| 361 |
"4 European cities with renowned veterinary or ag... "
|
| 362 |
]
|
| 363 |
},
|
| 364 |
-
"execution_count":
|
| 365 |
"metadata": {},
|
| 366 |
"output_type": "execute_result"
|
| 367 |
}
|
|
@@ -377,8 +377,8 @@
|
|
| 377 |
},
|
| 378 |
{
|
| 379 |
"cell_type": "code",
|
| 380 |
-
"execution_count":
|
| 381 |
-
"id": "
|
| 382 |
"metadata": {},
|
| 383 |
"outputs": [
|
| 384 |
{
|
|
@@ -391,10 +391,10 @@
|
|
| 391 |
{
|
| 392 |
"data": {
|
| 393 |
"text/plain": [
|
| 394 |
-
"['
|
| 395 |
]
|
| 396 |
},
|
| 397 |
-
"execution_count":
|
| 398 |
"metadata": {},
|
| 399 |
"output_type": "execute_result"
|
| 400 |
}
|
|
@@ -407,8 +407,8 @@
|
|
| 407 |
},
|
| 408 |
{
|
| 409 |
"cell_type": "code",
|
| 410 |
-
"execution_count":
|
| 411 |
-
"id": "
|
| 412 |
"metadata": {},
|
| 413 |
"outputs": [
|
| 414 |
{
|
|
@@ -467,7 +467,7 @@
|
|
| 467 |
" <td>Best European cities for intense physical trai...</td>\n",
|
| 468 |
" <td>\"Less crowded European cities to visit in Febr...</td>\n",
|
| 469 |
" <td>\"European cities with ice hockey facilities, l...</td>\n",
|
| 470 |
-
" <td>
|
| 471 |
" </tr>\n",
|
| 472 |
" <tr>\n",
|
| 473 |
" <th>1</th>\n",
|
|
@@ -482,7 +482,7 @@
|
|
| 482 |
" <td>Best European cities for live music, especiall...</td>\n",
|
| 483 |
" <td>'medium budget European city breaks with parks...</td>\n",
|
| 484 |
" <td>\"Medium budget European cities with parks and ...</td>\n",
|
| 485 |
-
" <td>
|
| 486 |
" </tr>\n",
|
| 487 |
" <tr>\n",
|
| 488 |
" <th>2</th>\n",
|
|
@@ -497,7 +497,7 @@
|
|
| 497 |
" <td>Where can I find inspiring European cities wit...</td>\n",
|
| 498 |
" <td>\"Looking for a popular and affordable European...</td>\n",
|
| 499 |
" <td>\"Low-budget European cities with museums and n...</td>\n",
|
| 500 |
-
" <td>
|
| 501 |
" </tr>\n",
|
| 502 |
" <tr>\n",
|
| 503 |
" <th>3</th>\n",
|
|
@@ -512,7 +512,7 @@
|
|
| 512 |
" <td>Best European cities for unique, artistic expe...</td>\n",
|
| 513 |
" <td>\"European cities with low popularity, monaster...</td>\n",
|
| 514 |
" <td>\"off the beaten path European city breaks in l...</td>\n",
|
| 515 |
-
" <td>
|
| 516 |
" </tr>\n",
|
| 517 |
" <tr>\n",
|
| 518 |
" <th>4</th>\n",
|
|
@@ -527,7 +527,7 @@
|
|
| 527 |
" <td>European cities with renowned veterinary or ag...</td>\n",
|
| 528 |
" <td>\"European cities for a luxurious trip.\"</td>\n",
|
| 529 |
" <td>\"European cities with horse riding trails and ...</td>\n",
|
| 530 |
-
" <td>
|
| 531 |
" </tr>\n",
|
| 532 |
" <tr>\n",
|
| 533 |
" <th>...</th>\n",
|
|
@@ -572,7 +572,7 @@
|
|
| 572 |
" <td>European cities with a grand, futuristic feel ...</td>\n",
|
| 573 |
" <td>'medium budget trip in April to a popular Euro...</td>\n",
|
| 574 |
" <td>\"Medium budget trip to a popular European city...</td>\n",
|
| 575 |
-
" <td>
|
| 576 |
" </tr>\n",
|
| 577 |
" <tr>\n",
|
| 578 |
" <th>197</th>\n",
|
|
@@ -587,7 +587,7 @@
|
|
| 587 |
" <td>Where can I find European cities rich in histo...</td>\n",
|
| 588 |
" <td>\"Less crowded European destinations with water...</td>\n",
|
| 589 |
" <td>\"Less crowded European destinations for a pric...</td>\n",
|
| 590 |
-
" <td>
|
| 591 |
" </tr>\n",
|
| 592 |
" <tr>\n",
|
| 593 |
" <th>198</th>\n",
|
|
@@ -602,7 +602,7 @@
|
|
| 602 |
" <td>Which European cities offer glimpses into the ...</td>\n",
|
| 603 |
" <td>\"European cities with great walkability and lo...</td>\n",
|
| 604 |
" <td>\"European cities with industrial heritage site...</td>\n",
|
| 605 |
-
" <td>
|
| 606 |
" </tr>\n",
|
| 607 |
" <tr>\n",
|
| 608 |
" <th>199</th>\n",
|
|
@@ -617,7 +617,7 @@
|
|
| 617 |
" <td>Affordable, safe European cities with historic...</td>\n",
|
| 618 |
" <td>'medium budget european city breaks in popular...</td>\n",
|
| 619 |
" <td>\"Medium budget city breaks in Europe for a sch...</td>\n",
|
| 620 |
-
" <td>
|
| 621 |
" </tr>\n",
|
| 622 |
" </tbody>\n",
|
| 623 |
"</table>\n",
|
|
@@ -756,22 +756,22 @@
|
|
| 756 |
"199 \"Medium budget city breaks in Europe for a sch... \n",
|
| 757 |
"\n",
|
| 758 |
" llama_query_p1 \n",
|
| 759 |
-
"0
|
| 760 |
-
"1
|
| 761 |
-
"2
|
| 762 |
-
"3
|
| 763 |
-
"4
|
| 764 |
".. ... \n",
|
| 765 |
"195 Which European cities offer a mix of cultural ... \n",
|
| 766 |
-
"196
|
| 767 |
-
"197
|
| 768 |
-
"198
|
| 769 |
-
"199
|
| 770 |
"\n",
|
| 771 |
"[200 rows x 12 columns]"
|
| 772 |
]
|
| 773 |
},
|
| 774 |
-
"execution_count":
|
| 775 |
"metadata": {},
|
| 776 |
"output_type": "execute_result"
|
| 777 |
}
|
|
@@ -784,8 +784,8 @@
|
|
| 784 |
},
|
| 785 |
{
|
| 786 |
"cell_type": "code",
|
| 787 |
-
"execution_count":
|
| 788 |
-
"id": "
|
| 789 |
"metadata": {},
|
| 790 |
"outputs": [
|
| 791 |
{
|
|
@@ -806,7 +806,7 @@
|
|
| 806 |
"dtype: int64"
|
| 807 |
]
|
| 808 |
},
|
| 809 |
-
"execution_count":
|
| 810 |
"metadata": {},
|
| 811 |
"output_type": "execute_result"
|
| 812 |
}
|
|
@@ -817,8 +817,8 @@
|
|
| 817 |
},
|
| 818 |
{
|
| 819 |
"cell_type": "code",
|
| 820 |
-
"execution_count":
|
| 821 |
-
"id": "
|
| 822 |
"metadata": {},
|
| 823 |
"outputs": [],
|
| 824 |
"source": [
|
|
@@ -828,7 +828,7 @@
|
|
| 828 |
{
|
| 829 |
"cell_type": "code",
|
| 830 |
"execution_count": null,
|
| 831 |
-
"id": "
|
| 832 |
"metadata": {},
|
| 833 |
"outputs": [],
|
| 834 |
"source": []
|
|
|
|
| 2 |
"cells": [
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "9e43247d",
|
| 7 |
"metadata": {},
|
| 8 |
"outputs": [],
|
| 9 |
"source": [
|
|
|
|
| 12 |
},
|
| 13 |
{
|
| 14 |
"cell_type": "code",
|
| 15 |
+
"execution_count": 2,
|
| 16 |
+
"id": "0ab32394",
|
| 17 |
"metadata": {},
|
| 18 |
"outputs": [
|
| 19 |
{
|
|
|
|
| 66 |
" <td>['Adana', 'Adiyaman', 'Agri', 'Arad', 'Arkhang...</td>\n",
|
| 67 |
" <td>\"Less crowded European cities to visit in Febr...</td>\n",
|
| 68 |
" <td>\"European cities with ice hockey facilities, l...</td>\n",
|
| 69 |
+
" <td>Which European cities have ice hockey arenas a...</td>\n",
|
| 70 |
" </tr>\n",
|
| 71 |
" <tr>\n",
|
| 72 |
" <th>1</th>\n",
|
|
|
|
| 78 |
" <td>['Coimbra', 'Brno', 'Braga']</td>\n",
|
| 79 |
" <td>'medium budget European city breaks with parks...</td>\n",
|
| 80 |
" <td>\"Medium budget European cities with parks and ...</td>\n",
|
| 81 |
+
" <td>Which European cities offer a mix of music fes...</td>\n",
|
| 82 |
" </tr>\n",
|
| 83 |
" <tr>\n",
|
| 84 |
" <th>2</th>\n",
|
|
|
|
| 90 |
" <td>['Zagreb', 'Volgograd', 'Tirana', 'Tbilisi', '...</td>\n",
|
| 91 |
" <td>\"Looking for a popular and affordable European...</td>\n",
|
| 92 |
" <td>\"Low-budget European cities with museums and n...</td>\n",
|
| 93 |
+
" <td>Which European cities offer a mix of historica...</td>\n",
|
| 94 |
" </tr>\n",
|
| 95 |
" <tr>\n",
|
| 96 |
" <th>3</th>\n",
|
|
|
|
| 102 |
" <td>['Van', 'Uzhhorod', 'Trabzon', 'Thessaloniki',...</td>\n",
|
| 103 |
" <td>\"European cities with low popularity, monaster...</td>\n",
|
| 104 |
" <td>\"off the beaten path European city breaks in l...</td>\n",
|
| 105 |
+
" <td>Which European cities offer a culturally rich ...</td>\n",
|
| 106 |
" </tr>\n",
|
| 107 |
" <tr>\n",
|
| 108 |
" <th>4</th>\n",
|
|
|
|
| 114 |
" <td>['Aalborg', 'Astrakhan', 'Bari', 'Bremen', 'Ch...</td>\n",
|
| 115 |
" <td>\"European cities for a luxurious trip.\"</td>\n",
|
| 116 |
" <td>\"European cities with horse riding trails and ...</td>\n",
|
| 117 |
+
" <td>Which European cities have horse riding school...</td>\n",
|
| 118 |
" </tr>\n",
|
| 119 |
" </tbody>\n",
|
| 120 |
"</table>\n",
|
|
|
|
| 171 |
"4 \"European cities with horse riding trails and ... \n",
|
| 172 |
"\n",
|
| 173 |
" llama_query_p1 \n",
|
| 174 |
+
"0 Which European cities have ice hockey arenas a... \n",
|
| 175 |
+
"1 Which European cities offer a mix of music fes... \n",
|
| 176 |
+
"2 Which European cities offer a mix of historica... \n",
|
| 177 |
+
"3 Which European cities offer a culturally rich ... \n",
|
| 178 |
+
"4 Which European cities have horse riding school... "
|
| 179 |
]
|
| 180 |
},
|
| 181 |
+
"execution_count": 2,
|
| 182 |
"metadata": {},
|
| 183 |
"output_type": "execute_result"
|
| 184 |
}
|
|
|
|
| 195 |
},
|
| 196 |
{
|
| 197 |
"cell_type": "code",
|
| 198 |
+
"execution_count": 3,
|
| 199 |
+
"id": "aed0fba7",
|
| 200 |
"metadata": {},
|
| 201 |
"outputs": [
|
| 202 |
{
|
|
|
|
| 361 |
"4 European cities with renowned veterinary or ag... "
|
| 362 |
]
|
| 363 |
},
|
| 364 |
+
"execution_count": 3,
|
| 365 |
"metadata": {},
|
| 366 |
"output_type": "execute_result"
|
| 367 |
}
|
|
|
|
| 377 |
},
|
| 378 |
{
|
| 379 |
"cell_type": "code",
|
| 380 |
+
"execution_count": 4,
|
| 381 |
+
"id": "7a0bbd7e",
|
| 382 |
"metadata": {},
|
| 383 |
"outputs": [
|
| 384 |
{
|
|
|
|
| 391 |
{
|
| 392 |
"data": {
|
| 393 |
"text/plain": [
|
| 394 |
+
"['config_id', 'persona_id', 'filters', 'persona', 'city', 'context']"
|
| 395 |
]
|
| 396 |
},
|
| 397 |
+
"execution_count": 4,
|
| 398 |
"metadata": {},
|
| 399 |
"output_type": "execute_result"
|
| 400 |
}
|
|
|
|
| 407 |
},
|
| 408 |
{
|
| 409 |
"cell_type": "code",
|
| 410 |
+
"execution_count": 5,
|
| 411 |
+
"id": "ca123dd4",
|
| 412 |
"metadata": {},
|
| 413 |
"outputs": [
|
| 414 |
{
|
|
|
|
| 467 |
" <td>Best European cities for intense physical trai...</td>\n",
|
| 468 |
" <td>\"Less crowded European cities to visit in Febr...</td>\n",
|
| 469 |
" <td>\"European cities with ice hockey facilities, l...</td>\n",
|
| 470 |
+
" <td>Which European cities have ice hockey arenas a...</td>\n",
|
| 471 |
" </tr>\n",
|
| 472 |
" <tr>\n",
|
| 473 |
" <th>1</th>\n",
|
|
|
|
| 482 |
" <td>Best European cities for live music, especiall...</td>\n",
|
| 483 |
" <td>'medium budget European city breaks with parks...</td>\n",
|
| 484 |
" <td>\"Medium budget European cities with parks and ...</td>\n",
|
| 485 |
+
" <td>Which European cities offer a mix of music fes...</td>\n",
|
| 486 |
" </tr>\n",
|
| 487 |
" <tr>\n",
|
| 488 |
" <th>2</th>\n",
|
|
|
|
| 497 |
" <td>Where can I find inspiring European cities wit...</td>\n",
|
| 498 |
" <td>\"Looking for a popular and affordable European...</td>\n",
|
| 499 |
" <td>\"Low-budget European cities with museums and n...</td>\n",
|
| 500 |
+
" <td>Which European cities offer a mix of historica...</td>\n",
|
| 501 |
" </tr>\n",
|
| 502 |
" <tr>\n",
|
| 503 |
" <th>3</th>\n",
|
|
|
|
| 512 |
" <td>Best European cities for unique, artistic expe...</td>\n",
|
| 513 |
" <td>\"European cities with low popularity, monaster...</td>\n",
|
| 514 |
" <td>\"off the beaten path European city breaks in l...</td>\n",
|
| 515 |
+
" <td>Which European cities offer a culturally rich ...</td>\n",
|
| 516 |
" </tr>\n",
|
| 517 |
" <tr>\n",
|
| 518 |
" <th>4</th>\n",
|
|
|
|
| 527 |
" <td>European cities with renowned veterinary or ag...</td>\n",
|
| 528 |
" <td>\"European cities for a luxurious trip.\"</td>\n",
|
| 529 |
" <td>\"European cities with horse riding trails and ...</td>\n",
|
| 530 |
+
" <td>Which European cities have horse riding school...</td>\n",
|
| 531 |
" </tr>\n",
|
| 532 |
" <tr>\n",
|
| 533 |
" <th>...</th>\n",
|
|
|
|
| 572 |
" <td>European cities with a grand, futuristic feel ...</td>\n",
|
| 573 |
" <td>'medium budget trip in April to a popular Euro...</td>\n",
|
| 574 |
" <td>\"Medium budget trip to a popular European city...</td>\n",
|
| 575 |
+
" <td>Which European cities have a rich history of e...</td>\n",
|
| 576 |
" </tr>\n",
|
| 577 |
" <tr>\n",
|
| 578 |
" <th>197</th>\n",
|
|
|
|
| 587 |
" <td>Where can I find European cities rich in histo...</td>\n",
|
| 588 |
" <td>\"Less crowded European destinations with water...</td>\n",
|
| 589 |
" <td>\"Less crowded European destinations for a pric...</td>\n",
|
| 590 |
+
" <td>European cities with rich history of philosoph...</td>\n",
|
| 591 |
" </tr>\n",
|
| 592 |
" <tr>\n",
|
| 593 |
" <th>198</th>\n",
|
|
|
|
| 602 |
" <td>Which European cities offer glimpses into the ...</td>\n",
|
| 603 |
" <td>\"European cities with great walkability and lo...</td>\n",
|
| 604 |
" <td>\"European cities with industrial heritage site...</td>\n",
|
| 605 |
+
" <td>Which European cities showcase historic indust...</td>\n",
|
| 606 |
" </tr>\n",
|
| 607 |
" <tr>\n",
|
| 608 |
" <th>199</th>\n",
|
|
|
|
| 617 |
" <td>Affordable, safe European cities with historic...</td>\n",
|
| 618 |
" <td>'medium budget european city breaks in popular...</td>\n",
|
| 619 |
" <td>\"Medium budget city breaks in Europe for a sch...</td>\n",
|
| 620 |
+
" <td>Which European cities offer a mix of cultural ...</td>\n",
|
| 621 |
" </tr>\n",
|
| 622 |
" </tbody>\n",
|
| 623 |
"</table>\n",
|
|
|
|
| 756 |
"199 \"Medium budget city breaks in Europe for a sch... \n",
|
| 757 |
"\n",
|
| 758 |
" llama_query_p1 \n",
|
| 759 |
+
"0 Which European cities have ice hockey arenas a... \n",
|
| 760 |
+
"1 Which European cities offer a mix of music fes... \n",
|
| 761 |
+
"2 Which European cities offer a mix of historica... \n",
|
| 762 |
+
"3 Which European cities offer a culturally rich ... \n",
|
| 763 |
+
"4 Which European cities have horse riding school... \n",
|
| 764 |
".. ... \n",
|
| 765 |
"195 Which European cities offer a mix of cultural ... \n",
|
| 766 |
+
"196 Which European cities have a rich history of e... \n",
|
| 767 |
+
"197 European cities with rich history of philosoph... \n",
|
| 768 |
+
"198 Which European cities showcase historic indust... \n",
|
| 769 |
+
"199 Which European cities offer a mix of cultural ... \n",
|
| 770 |
"\n",
|
| 771 |
"[200 rows x 12 columns]"
|
| 772 |
]
|
| 773 |
},
|
| 774 |
+
"execution_count": 5,
|
| 775 |
"metadata": {},
|
| 776 |
"output_type": "execute_result"
|
| 777 |
}
|
|
|
|
| 784 |
},
|
| 785 |
{
|
| 786 |
"cell_type": "code",
|
| 787 |
+
"execution_count": 7,
|
| 788 |
+
"id": "53314432",
|
| 789 |
"metadata": {},
|
| 790 |
"outputs": [
|
| 791 |
{
|
|
|
|
| 806 |
"dtype: int64"
|
| 807 |
]
|
| 808 |
},
|
| 809 |
+
"execution_count": 7,
|
| 810 |
"metadata": {},
|
| 811 |
"output_type": "execute_result"
|
| 812 |
}
|
|
|
|
| 817 |
},
|
| 818 |
{
|
| 819 |
"cell_type": "code",
|
| 820 |
+
"execution_count": 8,
|
| 821 |
+
"id": "b4e05bdc",
|
| 822 |
"metadata": {},
|
| 823 |
"outputs": [],
|
| 824 |
"source": [
|
|
|
|
| 828 |
{
|
| 829 |
"cell_type": "code",
|
| 830 |
"execution_count": null,
|
| 831 |
+
"id": "7abcac32",
|
| 832 |
"metadata": {},
|
| 833 |
"outputs": [],
|
| 834 |
"source": []
|
views/intro_screen.py
CHANGED
|
@@ -23,10 +23,14 @@ def welcome_screen():
|
|
| 23 |
st.markdown("""<style> .st-emotion-cache-1jicfl2 {width: 50%;} </style>""", unsafe_allow_html=True)
|
| 24 |
st.title("Welcome to the Feedback Survey")
|
| 25 |
|
| 26 |
-
username_input = st.text_input("Enter your
|
| 27 |
validation_code_input = st.text_input("Enter the validation code to proceed and press ENTER:")
|
| 28 |
|
| 29 |
next_button = st.button("Next")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
if (username_input and validation_code_input) or next_button:
|
| 32 |
if validate_username(username_input) and validate_code(validation_code_input):
|
|
|
|
| 23 |
st.markdown("""<style> .st-emotion-cache-1jicfl2 {width: 50%;} </style>""", unsafe_allow_html=True)
|
| 24 |
st.title("Welcome to the Feedback Survey")
|
| 25 |
|
| 26 |
+
username_input = st.text_input("Enter your first name and press TAB:")
|
| 27 |
validation_code_input = st.text_input("Enter the validation code to proceed and press ENTER:")
|
| 28 |
|
| 29 |
next_button = st.button("Next")
|
| 30 |
+
footer_html = """<div style='text-align: center; background-color:#ECECEC;padding:3rem;'> <p
|
| 31 |
+
style='font-size: large;'>⚠️ Note: This is still a work in progress. <br> If you encounter bugs or issues
|
| 32 |
+
please create a Pull Request and we will look into it.</br></p> </div> """
|
| 33 |
+
st.markdown(footer_html, unsafe_allow_html=True)
|
| 34 |
|
| 35 |
if (username_input and validation_code_input) or next_button:
|
| 36 |
if validate_username(username_input) and validate_code(validation_code_input):
|
views/nav_buttons.py
CHANGED
|
@@ -46,7 +46,7 @@ def navigation_buttons(data, response: Response):
|
|
| 46 |
if current_index > 0:
|
| 47 |
st.session_state.current_index -= 1
|
| 48 |
previous_ratings = st.session_state.ratings.get(st.session_state.current_index, {})
|
| 49 |
-
st.session_state.previous_ratings = previous_ratings
|
| 50 |
# st.session_state.previous_gemini_ratings = previous_ratings.get("gemini", {})
|
| 51 |
# st.session_state.previous_llama_ratings = previous_ratings.get("llama", {})
|
| 52 |
st.rerun()
|
|
@@ -62,6 +62,7 @@ def navigation_buttons(data, response: Response):
|
|
| 62 |
else:
|
| 63 |
if current_index < len(data) - 1:
|
| 64 |
st.session_state.current_index += 1
|
|
|
|
| 65 |
st.rerun()
|
| 66 |
else:
|
| 67 |
submit_feedback(current_index)
|
|
|
|
| 46 |
if current_index > 0:
|
| 47 |
st.session_state.current_index -= 1
|
| 48 |
previous_ratings = st.session_state.ratings.get(st.session_state.current_index, {})
|
| 49 |
+
# st.session_state.previous_ratings = previous_ratings
|
| 50 |
# st.session_state.previous_gemini_ratings = previous_ratings.get("gemini", {})
|
| 51 |
# st.session_state.previous_llama_ratings = previous_ratings.get("llama", {})
|
| 52 |
st.rerun()
|
|
|
|
| 62 |
else:
|
| 63 |
if current_index < len(data) - 1:
|
| 64 |
st.session_state.current_index += 1
|
| 65 |
+
# st.session_state.previous_ratings = {}
|
| 66 |
st.rerun()
|
| 67 |
else:
|
| 68 |
submit_feedback(current_index)
|
views/questions_screen.py
CHANGED
|
@@ -49,7 +49,10 @@ def display_ratings_row(model_name, config, current_index):
|
|
| 49 |
def render_query_ratings(model_name, query_label, config, query_key, current_index, has_persona_alignment=False):
|
| 50 |
"""Helper function to render ratings for a given query."""
|
| 51 |
# Get stored ratings if they exist
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
| 53 |
stored_query_ratings = {}
|
| 54 |
if previous_ratings:
|
| 55 |
if "query_v" in query_key:
|
|
|
|
| 49 |
def render_query_ratings(model_name, query_label, config, query_key, current_index, has_persona_alignment=False):
|
| 50 |
"""Helper function to render ratings for a given query."""
|
| 51 |
# Get stored ratings if they exist
|
| 52 |
+
if current_index < st.session_state.current_index:
|
| 53 |
+
previous_ratings = st.session_state.get("previous_ratings", {}).get(model_name, None)
|
| 54 |
+
else:
|
| 55 |
+
previous_ratings = None # Ensure new questions start fresh
|
| 56 |
stored_query_ratings = {}
|
| 57 |
if previous_ratings:
|
| 58 |
if "query_v" in query_key:
|