Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -550,7 +550,7 @@ def get_trending_spaces(search_query="", sort_by="rank", progress=gr.Progress())
|
|
550 |
progress(0, desc="Fetching spaces data...")
|
551 |
params = {
|
552 |
'full': 'true',
|
553 |
-
'limit': 10
|
554 |
}
|
555 |
|
556 |
response = requests.get(url, params=params)
|
@@ -573,16 +573,13 @@ def get_trending_spaces(search_query="", sort_by="rank", progress=gr.Progress())
|
|
573 |
reverse=True)
|
574 |
|
575 |
progress(0.1, desc="Creating gallery...")
|
576 |
-
html_content = """
|
577 |
-
<div style='padding: 20px; background: #f5f5f5;'>
|
578 |
-
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;'>
|
579 |
-
"""
|
580 |
|
581 |
for idx, space in enumerate(spaces):
|
582 |
html_content += get_card(space, idx, "space")
|
583 |
progress((0.1 + 0.9 * idx/len(spaces)), desc=f"Loading space {idx+1}/{len(spaces)}...")
|
584 |
|
585 |
-
html_content +=
|
586 |
|
587 |
progress(1.0, desc="Complete!")
|
588 |
return html_content, f"Found {len(spaces)} spaces"
|
@@ -621,16 +618,13 @@ def get_models(search_query="", sort_by="rank", progress=gr.Progress()) -> Tuple
|
|
621 |
reverse=True)
|
622 |
|
623 |
progress(0.1, desc="Creating gallery...")
|
624 |
-
html_content = """
|
625 |
-
<div style='padding: 20px; background: #f5f5f5;'>
|
626 |
-
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;'>
|
627 |
-
"""
|
628 |
|
629 |
for idx, model in enumerate(models):
|
630 |
html_content += get_card(model, idx, "model")
|
631 |
progress((0.1 + 0.9 * idx/len(models)), desc=f"Loading model {idx+1}/{len(models)}...")
|
632 |
|
633 |
-
html_content +=
|
634 |
|
635 |
progress(1.0, desc="Complete!")
|
636 |
return html_content, f"Found {len(models)} models"
|
@@ -670,17 +664,14 @@ def get_datasets(search_query="", sort_by="rank", progress=gr.Progress()) -> Tup
|
|
670 |
|
671 |
progress(0.1, desc="Creating gallery...")
|
672 |
|
673 |
-
#
|
674 |
-
html_content = """
|
675 |
-
<div style='padding: 20px; background: #f5f5f5;'>
|
676 |
-
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;'>
|
677 |
-
"""
|
678 |
|
679 |
for idx, dataset in enumerate(datasets):
|
680 |
html_content += get_card(dataset, idx, "dataset")
|
681 |
progress((0.1 + 0.9 * idx/len(datasets)), desc=f"Loading dataset {idx+1}/{len(datasets)}...")
|
682 |
|
683 |
-
html_content +=
|
684 |
|
685 |
progress(1.0, desc="Complete!")
|
686 |
return html_content, f"Found {len(datasets)} datasets"
|
@@ -773,7 +764,20 @@ def create_interface():
|
|
773 |
box-shadow: 0 6px 12px rgba(0,0,0,0.2);
|
774 |
background: linear-gradient(135deg, #8b71ff, #7376f1);
|
775 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
""") as interface:
|
|
|
777 |
|
778 |
gr.Markdown("""
|
779 |
# ๐ค HuggingFace Trending TOP 300 Board
|
|
|
550 |
progress(0, desc="Fetching spaces data...")
|
551 |
params = {
|
552 |
'full': 'true',
|
553 |
+
'limit': 10 # 10์์ 300์ผ๋ก ์์
|
554 |
}
|
555 |
|
556 |
response = requests.get(url, params=params)
|
|
|
573 |
reverse=True)
|
574 |
|
575 |
progress(0.1, desc="Creating gallery...")
|
576 |
+
html_content = '<div class="gallery-container"><div class="gallery-grid">'
|
|
|
|
|
|
|
577 |
|
578 |
for idx, space in enumerate(spaces):
|
579 |
html_content += get_card(space, idx, "space")
|
580 |
progress((0.1 + 0.9 * idx/len(spaces)), desc=f"Loading space {idx+1}/{len(spaces)}...")
|
581 |
|
582 |
+
html_content += '</div></div>'
|
583 |
|
584 |
progress(1.0, desc="Complete!")
|
585 |
return html_content, f"Found {len(spaces)} spaces"
|
|
|
618 |
reverse=True)
|
619 |
|
620 |
progress(0.1, desc="Creating gallery...")
|
621 |
+
html_content = '<div class="gallery-container"><div class="gallery-grid">'
|
|
|
|
|
|
|
622 |
|
623 |
for idx, model in enumerate(models):
|
624 |
html_content += get_card(model, idx, "model")
|
625 |
progress((0.1 + 0.9 * idx/len(models)), desc=f"Loading model {idx+1}/{len(models)}...")
|
626 |
|
627 |
+
html_content += '</div></div>'
|
628 |
|
629 |
progress(1.0, desc="Complete!")
|
630 |
return html_content, f"Found {len(models)} models"
|
|
|
664 |
|
665 |
progress(0.1, desc="Creating gallery...")
|
666 |
|
667 |
+
# ํต์ผ๋ HTML ๊ตฌ์กฐ
|
668 |
+
html_content = '<div class="gallery-container"><div class="gallery-grid">'
|
|
|
|
|
|
|
669 |
|
670 |
for idx, dataset in enumerate(datasets):
|
671 |
html_content += get_card(dataset, idx, "dataset")
|
672 |
progress((0.1 + 0.9 * idx/len(datasets)), desc=f"Loading dataset {idx+1}/{len(datasets)}...")
|
673 |
|
674 |
+
html_content += '</div></div>'
|
675 |
|
676 |
progress(1.0, desc="Complete!")
|
677 |
return html_content, f"Found {len(datasets)} datasets"
|
|
|
764 |
box-shadow: 0 6px 12px rgba(0,0,0,0.2);
|
765 |
background: linear-gradient(135deg, #8b71ff, #7376f1);
|
766 |
}
|
767 |
+
/* ๊ฐค๋ฌ๋ฆฌ ๊ทธ๋ฆฌ๋ ๋ ์ด์์์ ์ํ CSS ์ถ๊ฐ */
|
768 |
+
.gallery-container {
|
769 |
+
padding: 20px;
|
770 |
+
background: #f5f5f5;
|
771 |
+
width: 100%;
|
772 |
+
}
|
773 |
+
.gallery-grid {
|
774 |
+
display: grid;
|
775 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
776 |
+
gap: 20px;
|
777 |
+
width: 100%;
|
778 |
+
}
|
779 |
""") as interface:
|
780 |
+
|
781 |
|
782 |
gr.Markdown("""
|
783 |
# ๐ค HuggingFace Trending TOP 300 Board
|