openfree commited on
Commit
c5147b3
Β·
verified Β·
1 Parent(s): 1995dde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +101 -69
app.py CHANGED
@@ -661,12 +661,25 @@ def create_interface():
661
  box-shadow: 0 0 0 2px rgba(123,97,255,0.2);
662
  }
663
  .sort-radio {
664
- display: inline-flex;
665
- gap: 15px;
 
666
  background: #f5f5f5;
667
  padding: 10px;
668
  border-radius: 10px;
669
  }
 
 
 
 
 
 
 
 
 
 
 
 
670
  .refresh-btn {
671
  background: linear-gradient(135deg, #7b61ff, #6366f1);
672
  color: white;
@@ -675,6 +688,7 @@ def create_interface():
675
  border-radius: 10px;
676
  cursor: pointer;
677
  transition: all 0.3s ease;
 
678
  }
679
  .refresh-btn:hover {
680
  transform: translateY(-2px);
@@ -691,86 +705,87 @@ def create_interface():
691
  with gr.Tabs() as tabs:
692
  # Spaces νƒ­
693
  with gr.Tab("🎯 Trending Spaces"):
 
694
  with gr.Row(elem_classes="search-sort-container"):
695
- with gr.Row(equal_height=True):
696
- with gr.Column(scale=2):
697
- spaces_search = gr.Textbox(
698
- label="πŸ” Search Spaces",
699
- placeholder="Enter keywords to search...",
700
- elem_classes="search-box"
701
- )
702
- with gr.Column(scale=2):
703
- spaces_sort = gr.Radio(
704
- choices=["rank", "rising_rate", "popularity"],
705
- value="rank",
706
- label="πŸ“Š Sort by",
707
- interactive=True,
708
- elem_classes="sort-radio"
709
- )
710
- with gr.Column(scale=1):
711
- spaces_refresh_btn = gr.Button(
712
- "πŸ”„ Refresh",
713
- variant="primary",
714
- elem_classes="refresh-btn"
715
- )
716
  spaces_gallery = gr.HTML()
717
- spaces_status = gr.Markdown("Ready")
718
 
719
  # Models νƒ­
720
  with gr.Tab("πŸ€– Trending Models"):
 
721
  with gr.Row(elem_classes="search-sort-container"):
722
- with gr.Row(equal_height=True):
723
- with gr.Column(scale=2):
724
- models_search = gr.Textbox(
725
- label="πŸ” Search Models",
726
- placeholder="Enter keywords to search...",
727
- elem_classes="search-box"
728
- )
729
- with gr.Column(scale=2):
730
- models_sort = gr.Radio(
731
- choices=["rank", "rising_rate", "popularity"],
732
- value="rank",
733
- label="πŸ“Š Sort by",
734
- interactive=True,
735
- elem_classes="sort-radio"
736
- )
737
- with gr.Column(scale=1):
738
- models_refresh_btn = gr.Button(
739
- "πŸ”„ Refresh",
740
- variant="primary",
741
- elem_classes="refresh-btn"
742
- )
743
  models_gallery = gr.HTML()
744
- models_status = gr.Markdown("Ready")
745
 
746
  # Datasets νƒ­
747
  with gr.Tab("πŸ“Š Trending Datasets"):
 
 
748
  with gr.Row(elem_classes="search-sort-container"):
749
- with gr.Row(equal_height=True):
750
- with gr.Column(scale=2):
751
- datasets_search = gr.Textbox(
752
- label="πŸ” Search Datasets",
753
- placeholder="Enter keywords to search...",
754
- elem_classes="search-box"
755
- )
756
- with gr.Column(scale=2):
757
- datasets_sort = gr.Radio(
758
- choices=["rank", "rising_rate", "popularity"],
759
- value="rank",
760
- label="πŸ“Š Sort by",
761
- interactive=True,
762
- elem_classes="sort-radio"
763
- )
764
- with gr.Column(scale=1):
765
- datasets_refresh_btn = gr.Button(
766
- "πŸ”„ Refresh",
767
- variant="primary",
768
- elem_classes="refresh-btn"
769
- )
770
  datasets_gallery = gr.HTML()
771
- datasets_status = gr.Markdown("Ready")
772
 
773
- # Event handlers (λ‚˜λ¨Έμ§€ μ½”λ“œλŠ” 동일)
774
  spaces_refresh_btn.click(
775
  fn=get_trending_spaces,
776
  inputs=[spaces_search, spaces_sort],
@@ -827,6 +842,23 @@ def create_interface():
827
  outputs=[datasets_gallery, datasets_status]
828
  )
829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
830
  return interface
831
 
832
  if __name__ == "__main__":
 
661
  box-shadow: 0 0 0 2px rgba(123,97,255,0.2);
662
  }
663
  .sort-radio {
664
+ display: flex;
665
+ justify-content: space-between;
666
+ gap: 10px;
667
  background: #f5f5f5;
668
  padding: 10px;
669
  border-radius: 10px;
670
  }
671
+ .sort-radio label {
672
+ flex: 1;
673
+ text-align: center;
674
+ padding: 8px;
675
+ background: white;
676
+ border-radius: 8px;
677
+ cursor: pointer;
678
+ transition: all 0.3s ease;
679
+ }
680
+ .sort-radio label:hover {
681
+ background: #e0e0e0;
682
+ }
683
  .refresh-btn {
684
  background: linear-gradient(135deg, #7b61ff, #6366f1);
685
  color: white;
 
688
  border-radius: 10px;
689
  cursor: pointer;
690
  transition: all 0.3s ease;
691
+ width: 120px; /* λ²„νŠΌ λ„ˆλΉ„ μ‘°μ • */
692
  }
693
  .refresh-btn:hover {
694
  transform: translateY(-2px);
 
705
  with gr.Tabs() as tabs:
706
  # Spaces νƒ­
707
  with gr.Tab("🎯 Trending Spaces"):
708
+ gr.Markdown("Shows top 300 trending spaces with AI ratings")
709
  with gr.Row(elem_classes="search-sort-container"):
710
+ with gr.Column(scale=2):
711
+ spaces_search = gr.Textbox(
712
+ label="πŸ” Search Spaces",
713
+ placeholder="Enter keywords to search...",
714
+ elem_classes="search-box"
715
+ )
716
+ with gr.Column(scale=2):
717
+ spaces_sort = gr.Radio(
718
+ choices=["rank", "rising_rate", "popularity"],
719
+ value="rank",
720
+ label="πŸ“Š Sort by",
721
+ interactive=True,
722
+ elem_classes="sort-radio"
723
+ )
724
+ with gr.Column(scale=1):
725
+ spaces_refresh_btn = gr.Button(
726
+ "πŸ”„ Refresh",
727
+ variant="primary",
728
+ elem_classes="refresh-btn"
729
+ )
 
730
  spaces_gallery = gr.HTML()
731
+ spaces_status = gr.Markdown("Loading...")
732
 
733
  # Models νƒ­
734
  with gr.Tab("πŸ€– Trending Models"):
735
+ gr.Markdown("Shows top 300 trending models with AI ratings")
736
  with gr.Row(elem_classes="search-sort-container"):
737
+ with gr.Column(scale=2):
738
+ models_search = gr.Textbox(
739
+ label="πŸ” Search Models",
740
+ placeholder="Enter keywords to search...",
741
+ elem_classes="search-box"
742
+ )
743
+ with gr.Column(scale=2):
744
+ models_sort = gr.Radio(
745
+ choices=["rank", "rising_rate", "popularity"],
746
+ value="rank",
747
+ label="πŸ“Š Sort by",
748
+ interactive=True,
749
+ elem_classes="sort-radio"
750
+ )
751
+ with gr.Column(scale=1):
752
+ models_refresh_btn = gr.Button(
753
+ "πŸ”„ Refresh",
754
+ variant="primary",
755
+ elem_classes="refresh-btn"
756
+ )
 
757
  models_gallery = gr.HTML()
758
+ models_status = gr.Markdown("Loading...")
759
 
760
  # Datasets νƒ­
761
  with gr.Tab("πŸ“Š Trending Datasets"):
762
+ gr.Markdown("Shows top 300 trending datasets with AI ratings")
763
+
764
  with gr.Row(elem_classes="search-sort-container"):
765
+ with gr.Column(scale=2):
766
+ datasets_search = gr.Textbox(
767
+ label="πŸ” Search Datasets",
768
+ placeholder="Enter keywords to search...",
769
+ elem_classes="search-box"
770
+ )
771
+ with gr.Column(scale=2):
772
+ datasets_sort = gr.Radio(
773
+ choices=["rank", "rising_rate", "popularity"],
774
+ value="rank",
775
+ label="πŸ“Š Sort by",
776
+ interactive=True,
777
+ elem_classes="sort-radio"
778
+ )
779
+ with gr.Column(scale=1):
780
+ datasets_refresh_btn = gr.Button(
781
+ "πŸ”„ Refresh",
782
+ variant="primary",
783
+ elem_classes="refresh-btn"
784
+ )
 
785
  datasets_gallery = gr.HTML()
786
+ datasets_status = gr.Markdown("Loading...")
787
 
788
+ # Event handlers
789
  spaces_refresh_btn.click(
790
  fn=get_trending_spaces,
791
  inputs=[spaces_search, spaces_sort],
 
842
  outputs=[datasets_gallery, datasets_status]
843
  )
844
 
845
+ # 초기 데이터 λ‘œλ“œ
846
+ interface.load(
847
+ fn=get_trending_spaces,
848
+ inputs=[spaces_search, spaces_sort],
849
+ outputs=[spaces_gallery, spaces_status]
850
+ )
851
+ interface.load(
852
+ fn=get_models,
853
+ inputs=[models_search, models_sort],
854
+ outputs=[models_gallery, models_status]
855
+ )
856
+ interface.load(
857
+ fn=get_datasets,
858
+ inputs=[datasets_search, datasets_sort],
859
+ outputs=[datasets_gallery, datasets_status]
860
+ )
861
+
862
  return interface
863
 
864
  if __name__ == "__main__":