nomadicsynth commited on
Commit
51e39cd
Β·
1 Parent(s): ba890ea

Refactor feedback components into accordions for improved organization and user experience

Browse files
Files changed (1) hide show
  1. app.py +29 -28
app.py CHANGED
@@ -590,18 +590,19 @@ def create_interface():
590
  key="paper_details",
591
  )
592
  analyze_btn = gr.Button("Analyze Connections", variant="primary", visible=False)
593
- gr.Markdown(
594
- """
595
- Please provide feedback on the paper match and analysis to improve the model.
596
- """
597
- )
598
- # Add thumbs up/down for paper match
599
- paper_feedback = gr.Radio(
600
- ["πŸ‘ Good Match", "πŸ‘Ž Poor Match"], label="Is this paper a good match?", visible=False
601
- )
602
- paper_expert = gr.Checkbox(label="I am an expert in this field", value=False, visible=False)
603
- paper_comment = gr.Textbox(label="Additional feedback on this paper match (optional)", visible=False)
604
- flag_paper_btn = gr.Button("Submit Paper Feedback", visible=False)
 
605
 
606
  with gr.Column(scale=1):
607
  analysis_output = gr.Markdown(
@@ -611,12 +612,20 @@ def create_interface():
611
  show_copy_button=True,
612
  key="analysis_output",
613
  )
614
- # Add thumbs up/down for analysis
615
- analysis_feedback = gr.Radio(
616
- ["πŸ‘ Helpful", "πŸ‘Ž Not Helpful"], label="Was this analysis helpful?", visible=False
617
- )
618
- analysis_comment = gr.Textbox(label="Additional feedback on analysis (optional)", visible=False)
619
- flag_analysis_btn = gr.Button("Submit Analysis Feedback", visible=False)
 
 
 
 
 
 
 
 
620
 
621
  # Set up logging directories
622
  data_path = "/data" if persistent_storage else "./data"
@@ -629,18 +638,10 @@ def create_interface():
629
  data_path + "/flagged_paper_matches",
630
  )
631
  analysis_logger.setup(
632
- [paper_details_output, analysis_output, analysis_feedback, analysis_comment],
633
  data_path + "/flagged_analyses",
634
  )
635
 
636
- # Show feedback component
637
- def show_feedback():
638
- return gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
639
-
640
- # Hide feedback component
641
- def hide_feedback():
642
- return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
643
-
644
  # Display paper details when row is selected
645
  def on_select(evt: gr.SelectData, papers, query):
646
  selected_index = evt.index[0] # Get the row index
@@ -687,7 +688,7 @@ def create_interface():
687
  outputs=[analyze_btn],
688
  api_name=False,
689
  ).then(
690
- show_feedback,
691
  outputs=[paper_feedback, paper_comment, flag_paper_btn],
692
  api_name=False,
693
  )
 
590
  key="paper_details",
591
  )
592
  analyze_btn = gr.Button("Analyze Connections", variant="primary", visible=False)
593
+ with gr.Accordion(label="Feedback and Flagging", open=True, visible=False) as paper_feedback_accordion:
594
+ gr.Markdown(
595
+ """
596
+ Please provide feedback on the paper match and analysis to improve the model.
597
+ """
598
+ )
599
+ # Add thumbs up/down for paper match
600
+ paper_feedback = gr.Radio(
601
+ ["πŸ‘ Good Match", "πŸ‘Ž Poor Match"], label="Is this paper a good match?",
602
+ )
603
+ paper_expert = gr.Checkbox(label="I am an expert in this field", value=False)
604
+ paper_comment = gr.Textbox(label="Additional feedback on this paper match (optional)")
605
+ flag_paper_btn = gr.Button("Submit Paper Feedback")
606
 
607
  with gr.Column(scale=1):
608
  analysis_output = gr.Markdown(
 
612
  show_copy_button=True,
613
  key="analysis_output",
614
  )
615
+ with gr.Accordion(label="Feedback and Flagging", open=True, visible=False) as analysis_feedback_accordion:
616
+ gr.Markdown(
617
+ """
618
+ The analysis is generated by an AI model and may not be perfect.
619
+ If you find any errors or have suggestions for improvement, please let us know.
620
+ Your feedback is valuable and will be used to improve the model and prompt.
621
+ """
622
+ )
623
+ # Add thumbs up/down for analysis
624
+ analysis_feedback = gr.Radio(
625
+ ["πŸ‘ Helpful", "πŸ‘Ž Not Helpful"], label="Was this analysis helpful?", visible=False
626
+ )
627
+ analysis_comment = gr.Textbox(label="Additional feedback on analysis (optional)", visible=False)
628
+ flag_analysis_btn = gr.Button("Submit Analysis Feedback", visible=False)
629
 
630
  # Set up logging directories
631
  data_path = "/data" if persistent_storage else "./data"
 
638
  data_path + "/flagged_paper_matches",
639
  )
640
  analysis_logger.setup(
641
+ [abstract_input, paper_details_output, analysis_output, analysis_feedback, analysis_comment],
642
  data_path + "/flagged_analyses",
643
  )
644
 
 
 
 
 
 
 
 
 
645
  # Display paper details when row is selected
646
  def on_select(evt: gr.SelectData, papers, query):
647
  selected_index = evt.index[0] # Get the row index
 
688
  outputs=[analyze_btn],
689
  api_name=False,
690
  ).then(
691
+ lambda: gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), # Show feedback options
692
  outputs=[paper_feedback, paper_comment, flag_paper_btn],
693
  api_name=False,
694
  )