Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -641,55 +641,136 @@ def fetch_items(item_type, search_query="", sort_by="rank", limit=1000):
|
|
641 |
print(f"Error fetching items: {e}")
|
642 |
return []
|
643 |
|
644 |
-
# μΈν°νμ΄μ€ μμ
|
645 |
def create_interface():
|
646 |
-
with gr.Blocks(title="HuggingFace Trending Board"
|
647 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
|
649 |
with gr.Tabs() as tabs:
|
650 |
# Spaces ν
|
651 |
with gr.Tab("π― Trending Spaces"):
|
652 |
-
with gr.
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
spaces_gallery = gr.HTML()
|
662 |
spaces_status = gr.Markdown("Ready")
|
663 |
|
664 |
# Models ν
|
665 |
with gr.Tab("π€ Trending Models"):
|
666 |
-
with gr.
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
models_gallery = gr.HTML()
|
676 |
models_status = gr.Markdown("Ready")
|
677 |
|
678 |
# Datasets ν
|
679 |
with gr.Tab("π Trending Datasets"):
|
680 |
-
with gr.
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
datasets_gallery = gr.HTML()
|
690 |
datasets_status = gr.Markdown("Ready")
|
691 |
|
692 |
-
# Event handlers
|
693 |
spaces_refresh_btn.click(
|
694 |
fn=get_trending_spaces,
|
695 |
inputs=[spaces_search, spaces_sort],
|
|
|
641 |
print(f"Error fetching items: {e}")
|
642 |
return []
|
643 |
|
|
|
644 |
def create_interface():
|
645 |
+
with gr.Blocks(title="HuggingFace Trending Board", css="""
|
646 |
+
.search-sort-container {
|
647 |
+
background: rgba(255,255,255,0.9);
|
648 |
+
border-radius: 15px;
|
649 |
+
padding: 20px;
|
650 |
+
margin: 10px 0;
|
651 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
652 |
+
}
|
653 |
+
.search-box {
|
654 |
+
border: 2px solid #e1e1e1;
|
655 |
+
border-radius: 10px;
|
656 |
+
padding: 10px;
|
657 |
+
transition: all 0.3s ease;
|
658 |
+
}
|
659 |
+
.search-box:focus {
|
660 |
+
border-color: #7b61ff;
|
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;
|
673 |
+
border: none;
|
674 |
+
padding: 10px 20px;
|
675 |
+
border-radius: 10px;
|
676 |
+
cursor: pointer;
|
677 |
+
transition: all 0.3s ease;
|
678 |
+
}
|
679 |
+
.refresh-btn:hover {
|
680 |
+
transform: translateY(-2px);
|
681 |
+
box-shadow: 0 4px 12px rgba(99,102,241,0.4);
|
682 |
+
}
|
683 |
+
""") as interface:
|
684 |
+
gr.Markdown("""
|
685 |
+
# π€ HuggingFace Trending TOP 300 Board
|
686 |
+
<div style='margin-bottom: 20px; padding: 10px; background: linear-gradient(135deg, rgba(123,97,255,0.1), rgba(99,102,241,0.1)); border-radius: 10px;'>
|
687 |
+
Explore, search, and sort through the top AI content from HuggingFace
|
688 |
+
</div>
|
689 |
+
""")
|
690 |
|
691 |
with gr.Tabs() as tabs:
|
692 |
# Spaces ν
|
693 |
with gr.Tab("π― Trending Spaces"):
|
694 |
+
with gr.Box(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.Box(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.Box(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],
|