Spaces:
Sleeping
Sleeping
tung
commited on
Commit
·
93b5d9d
1
Parent(s):
7095e55
fix data
Browse files
app.py
CHANGED
|
@@ -205,16 +205,16 @@ def start_or_resume(user_id: str, proficiency: str, state_df):
|
|
| 205 |
def submit_preference(
|
| 206 |
user_id: str, proficiency: str, row_idx_str: str, choice: str, state_df
|
| 207 |
):
|
| 208 |
-
if choice not in {"
|
| 209 |
return (
|
| 210 |
"",
|
| 211 |
"",
|
| 212 |
"",
|
| 213 |
"",
|
| 214 |
-
"Please choose either
|
| 215 |
)
|
| 216 |
row_idx = int(row_idx_str)
|
| 217 |
-
save_rating(user_id, proficiency, row_idx, 1 if choice == "
|
| 218 |
ratings = load_ratings()
|
| 219 |
record = get_next_unrated(state_df, ratings, user_id)
|
| 220 |
if record is None:
|
|
@@ -271,7 +271,7 @@ Enter your identifier below to start or resume. Each sample is a pair of two sen
|
|
| 271 |
answer1_md = gr.Markdown(label="Sentence A", elem_classes=["answerbox"])
|
| 272 |
answer2_md = gr.Markdown(label="Sentence B", elem_classes=["answerbox"])
|
| 273 |
choice_radio = gr.Radio(
|
| 274 |
-
["
|
| 275 |
)
|
| 276 |
submit_btn = gr.Button("Submit Preference", visible=False)
|
| 277 |
|
|
|
|
| 205 |
def submit_preference(
|
| 206 |
user_id: str, proficiency: str, row_idx_str: str, choice: str, state_df
|
| 207 |
):
|
| 208 |
+
if choice not in {"Sentence 1", "Sentence 2"}:
|
| 209 |
return (
|
| 210 |
"",
|
| 211 |
"",
|
| 212 |
"",
|
| 213 |
"",
|
| 214 |
+
"Please choose either Sentence 1 or Sentence 2 before submitting.",
|
| 215 |
)
|
| 216 |
row_idx = int(row_idx_str)
|
| 217 |
+
save_rating(user_id, proficiency, row_idx, 1 if choice == "Sentence 1" else 2)
|
| 218 |
ratings = load_ratings()
|
| 219 |
record = get_next_unrated(state_df, ratings, user_id)
|
| 220 |
if record is None:
|
|
|
|
| 271 |
answer1_md = gr.Markdown(label="Sentence A", elem_classes=["answerbox"])
|
| 272 |
answer2_md = gr.Markdown(label="Sentence B", elem_classes=["answerbox"])
|
| 273 |
choice_radio = gr.Radio(
|
| 274 |
+
["Sentence 1", "Sentence 2"], label="Which sentence do you prefer?"
|
| 275 |
)
|
| 276 |
submit_btn = gr.Button("Submit Preference", visible=False)
|
| 277 |
|