akhaliq HF staff commited on
Commit
c80b1ae
·
verified ·
1 Parent(s): 6790790

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -20
app.py CHANGED
@@ -550,6 +550,7 @@ table {
550
  }
551
  """
552
 
 
553
  # --- Initialize Gradio Blocks ---
554
 
555
  demo = gr.Blocks(css=css)
@@ -635,23 +636,20 @@ with demo:
635
  </script>
636
  """)
637
 
638
- # Sort option change
 
 
 
 
 
 
639
  sort_radio.change(
640
- fn=lambda method: method.lower(),
641
  inputs=[sort_radio],
642
- outputs=None,
643
- _js="""
644
- (method) => {
645
- if (method === 'top') {
646
- document.querySelector('[label="Time Frame for Top"]').style.display = 'block';
647
- } else {
648
- document.querySelector('[label="Time Frame for Top"]').style.display = 'none';
649
- }
650
- return method;
651
- }
652
- """
653
  )
654
 
 
655
  sort_radio.change(
656
  fn=change_sort_method_ui,
657
  inputs=[sort_radio, time_frame_dropdown],
@@ -672,13 +670,6 @@ with demo:
672
  outputs=[paper_list]
673
  )
674
 
675
- # Footer
676
- gr.Markdown("""
677
- Related useful Spaces:
678
- - [Semantic Scholar Paper Recommender](https://huggingface.co/spaces/librarian-bots/recommend_similar_papers) by [davanstrien](https://huggingface.co/davanstrien)
679
- - [ArXiv CS RAG](https://huggingface.co/spaces/bishmoy/Arxiv-CS-RAG) by [bishmoy](https://huggingface.co/bishmoy)
680
- - [Paper Q&A](https://huggingface.co/spaces/chansung/paper_qa) by [chansung](https://huggingface.co/chansung)
681
- """)
682
 
683
 
684
  # --- Launch the App ---
 
550
  }
551
  """
552
 
553
+
554
  # --- Initialize Gradio Blocks ---
555
 
556
  demo = gr.Blocks(css=css)
 
636
  </script>
637
  """)
638
 
639
+ # Sort option change: Toggle visibility of time_frame_dropdown based on sort method
640
+ def toggle_time_frame_visibility(sort_method):
641
+ if sort_method.lower() == "top":
642
+ return gr.update(visible=True)
643
+ else:
644
+ return gr.update(visible=False)
645
+
646
  sort_radio.change(
647
+ fn=toggle_time_frame_visibility,
648
  inputs=[sort_radio],
649
+ outputs=[time_frame_dropdown]
 
 
 
 
 
 
 
 
 
 
650
  )
651
 
652
+ # Sort option change: Apply sorting method with time frame if applicable
653
  sort_radio.change(
654
  fn=change_sort_method_ui,
655
  inputs=[sort_radio, time_frame_dropdown],
 
670
  outputs=[paper_list]
671
  )
672
 
 
 
 
 
 
 
 
673
 
674
 
675
  # --- Launch the App ---