shgao commited on
Commit
0433ab9
·
1 Parent(s): 2e80564
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -515,6 +515,7 @@ def go_to_eval_progress_modal(name, email, evaluator_id, specialty_dd, subspecia
515
 
516
  # Map advance_workflow outputs to the required return format
517
  # advance_workflow 已经确保返回正确长度的列表,不需要额外检查
 
518
  return (
519
  gr.update(visible=False), # page0
520
  ui_updates.get('page1_visible', gr.update(visible=False)), # page1
@@ -525,7 +526,7 @@ def go_to_eval_progress_modal(name, email, evaluator_id, specialty_dd, subspecia
525
  ui_updates.get('page2_prompt', ""), # page2_prompt
526
  data_subset_state['reference_answer'], # page1_reference_answer
527
  data_subset_state['reference_answer'], # page2_reference_answer
528
- f"You are about to evaluate the next question. You have {remaining_count} question(s) remaining to evaluate.", # eval_progress_text
529
  user_info, # user_info_state
530
  data_subset_state, # data_subset_state
531
  ui_updates.get('progress_state', progress_state), # progress_state
@@ -1310,14 +1311,14 @@ def advance_workflow(progress_state, data_subset_state, current_pairwise=None, c
1310
  'progress_state': progress_state,
1311
  'page1_visible': gr.update(visible=True), # Keep page1 visible
1312
  'page2_visible': gr.update(visible=False), # Hide page2
1313
- 'pairwise_radios': [gr.update() for _ in range(criteria_for_comparison)],
1314
  'pairwise_reasons': [gr.update() for _ in range(len_criteria)],
1315
  'chat_a_page1': gr.update(), # Keep chat_a unchanged
1316
  'chat_b_page1': gr.update(), # Keep chat_b unchanged
1317
  'page1_prompt': gr.update(), # Keep page1_prompt unchanged
1318
  'chat_a_page2': gr.update(), # Keep chat_a_page2 unchanged
1319
  'chat_b_page2': gr.update(), # Keep chat_b_page2 unchanged
1320
- 'page2_prompt': gr.update(), # Keep chat_b_page2 unchanged
1321
  'pairwise_results_for_display': default_pairwise_results
1322
  }
1323
 
@@ -1685,7 +1686,8 @@ def submit_pairwise_scoring(progress_state, data_subset_state, user_info, *ratin
1685
  # Use advance_workflow to get all UI updates
1686
  ui_updates = advance_workflow(progress_state, data_subset_state)
1687
  print(f"\033[93mIn submit_pairwise_scoring, using advance_workflow results: mode={progress_state.get('mode')}\033[0m")
1688
- gr.Info(f"You are about to evaluate the next question. You have {remaining_count} question(s) remaining to evaluate.") # eval_progress_text
 
1689
  return (
1690
  ui_updates.get('page1_visible'), # 5
1691
  ui_updates.get('page2_visible'), # 6
@@ -1949,9 +1951,7 @@ with gr.Blocks(css=centered_col_css) as demo:
1949
  - If you wish to evaluate multiple questions, you may do so; you will never be asked to re-evaluate questions you have already seen.
1950
  - When evaluating a question, you will be asked to compare the responses of two different models to the question and then rate each model's response on a scale of 1-5.
1951
  - If you feel that a question does not make sense or is not biomedically relevant, there is a RED BUTTON at the top of the first model comparison page to indicate this
1952
- - You may use the Back and Next buttons at the bottom of each page to edit any of your responses before submitting.
1953
- - You may use the Home Page button at the bottom of each page to the home page. Your progress will be saved but not submitted.
1954
- - You must submit your answers to the current question before moving on to evaluate the next question.
1955
  - You may stop in between questions and return at a later time; however, you must submit your answers to the current question if you would like them saved.
1956
  - Please review the example question and LLM model response below:
1957
 
@@ -2114,12 +2114,12 @@ with gr.Blocks(css=centered_col_css) as demo:
2114
  page1_error_box = gr.Markdown("") # ADDED: display validation errors
2115
  with gr.Row():
2116
  # back_btn_0 = gr.Button("Back")
2117
- next_btn_1 = gr.Button("Next: Rate Responses")
2118
 
2119
  with gr.Row():
2120
  # ADDED: Home button on page11
2121
  home_btn_1 = gr.Button(
2122
- "Home Page (your progress on this question will be saved but not submitted)")
2123
 
2124
  # Page 2: Combined Rating Page for both responses.
2125
  with gr.Column(visible=False) as page2:
@@ -2214,11 +2214,11 @@ with gr.Blocks(css=centered_col_css) as demo:
2214
  with gr.Row():
2215
  # back_btn_2 = gr.Button("Back")
2216
  submit_btn = gr.Button(
2217
- "Submit (Note: Once submitted, you cannot edit your responses)", elem_id="submit_btn")
2218
 
2219
  with gr.Row():
2220
  home_btn_2 = gr.Button(
2221
- "Home Page (your progress on this question will be saved but not submitted)")
2222
 
2223
  result_text = gr.Textbox(label="Validation Result")
2224
 
 
515
 
516
  # Map advance_workflow outputs to the required return format
517
  # advance_workflow 已经确保返回正确长度的列表,不需要额外检查
518
+ num_remaining_questions = remaining_count// len(progress_state['all_pairs'])
519
  return (
520
  gr.update(visible=False), # page0
521
  ui_updates.get('page1_visible', gr.update(visible=False)), # page1
 
526
  ui_updates.get('page2_prompt', ""), # page2_prompt
527
  data_subset_state['reference_answer'], # page1_reference_answer
528
  data_subset_state['reference_answer'], # page2_reference_answer
529
+ f"You are about to evaluate the next question. You have {num_remaining_questions} question(s) remaining to evaluate.", # eval_progress_text
530
  user_info, # user_info_state
531
  data_subset_state, # data_subset_state
532
  ui_updates.get('progress_state', progress_state), # progress_state
 
1311
  'progress_state': progress_state,
1312
  'page1_visible': gr.update(visible=True), # Keep page1 visible
1313
  'page2_visible': gr.update(visible=False), # Hide page2
1314
+ 'pairwise_radios': [gr.update() for _ in range(len_criteria)],
1315
  'pairwise_reasons': [gr.update() for _ in range(len_criteria)],
1316
  'chat_a_page1': gr.update(), # Keep chat_a unchanged
1317
  'chat_b_page1': gr.update(), # Keep chat_b unchanged
1318
  'page1_prompt': gr.update(), # Keep page1_prompt unchanged
1319
  'chat_a_page2': gr.update(), # Keep chat_a_page2 unchanged
1320
  'chat_b_page2': gr.update(), # Keep chat_b_page2 unchanged
1321
+ 'page2_prompt': gr.update(), # Keep page2_prompt unchanged
1322
  'pairwise_results_for_display': default_pairwise_results
1323
  }
1324
 
 
1686
  # Use advance_workflow to get all UI updates
1687
  ui_updates = advance_workflow(progress_state, data_subset_state)
1688
  print(f"\033[93mIn submit_pairwise_scoring, using advance_workflow results: mode={progress_state.get('mode')}\033[0m")
1689
+ num_remaining_questions = remaining_count// len(progress_state['all_pairs'])
1690
+ gr.Info(f"You are about to evaluate the next question. You have {num_remaining_questions} question(s) remaining to evaluate.") # eval_progress_text
1691
  return (
1692
  ui_updates.get('page1_visible'), # 5
1693
  ui_updates.get('page2_visible'), # 6
 
1951
  - If you wish to evaluate multiple questions, you may do so; you will never be asked to re-evaluate questions you have already seen.
1952
  - When evaluating a question, you will be asked to compare the responses of two different models to the question and then rate each model's response on a scale of 1-5.
1953
  - If you feel that a question does not make sense or is not biomedically relevant, there is a RED BUTTON at the top of the first model comparison page to indicate this
1954
+ - You may use the Next buttons at the bottom of each page to submit your current response and go to the next question.
 
 
1955
  - You may stop in between questions and return at a later time; however, you must submit your answers to the current question if you would like them saved.
1956
  - Please review the example question and LLM model response below:
1957
 
 
2114
  page1_error_box = gr.Markdown("") # ADDED: display validation errors
2115
  with gr.Row():
2116
  # back_btn_0 = gr.Button("Back")
2117
+ next_btn_1 = gr.Button("Submit & Next One (Once submitted, you cannot edit your responses)",)
2118
 
2119
  with gr.Row():
2120
  # ADDED: Home button on page11
2121
  home_btn_1 = gr.Button(
2122
+ "Home Page")
2123
 
2124
  # Page 2: Combined Rating Page for both responses.
2125
  with gr.Column(visible=False) as page2:
 
2214
  with gr.Row():
2215
  # back_btn_2 = gr.Button("Back")
2216
  submit_btn = gr.Button(
2217
+ "Submit & Next One (Once submitted, you cannot edit your responses)", elem_id="submit_btn")
2218
 
2219
  with gr.Row():
2220
  home_btn_2 = gr.Button(
2221
+ "Home Page")
2222
 
2223
  result_text = gr.Textbox(label="Validation Result")
2224