Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -246,6 +246,28 @@ def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
|
246 |
likes = format(item.get('likes', 0), ',')
|
247 |
created = item.get('createdAt', '').split('T')[0]
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
# URL ์ ์
|
250 |
if card_type == "space":
|
251 |
url = f"https://huggingface.co/spaces/{item_id}"
|
@@ -664,41 +686,56 @@ def create_interface():
|
|
664 |
box-shadow: 0 0 0 2px rgba(123,97,255,0.2);
|
665 |
background: linear-gradient(135deg, #ffffff, #f0f3ff);
|
666 |
}
|
667 |
-
/* ์ ๋ ฌ ๋ผ๋์ค ๋ฒํผ ์ปจํ
์ด๋
|
668 |
.sort-radio {
|
669 |
display: flex !important;
|
670 |
-
justify-content:
|
671 |
gap: 10px !important;
|
672 |
background: linear-gradient(135deg, #f5f5ff, #f0f0ff);
|
673 |
padding: 12px;
|
674 |
border-radius: 10px;
|
675 |
-
width:
|
676 |
-
|
677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
}
|
679 |
-
|
|
|
680 |
.sort-radio label {
|
681 |
-
|
|
|
682 |
text-align: center !important;
|
683 |
-
padding: 10px 15px !important;
|
684 |
background: linear-gradient(135deg, #ffffff, #f8f9ff);
|
685 |
border-radius: 8px;
|
686 |
cursor: pointer;
|
687 |
transition: all 0.3s ease;
|
688 |
border: 1px solid rgba(123,97,255,0.1);
|
689 |
-
white-space: nowrap !important;
|
690 |
-
|
691 |
-
|
692 |
}
|
|
|
693 |
.sort-radio label:hover {
|
694 |
background: linear-gradient(135deg, #f0f3ff, #e8ecff);
|
695 |
border-color: rgba(123,97,255,0.3);
|
696 |
}
|
|
|
697 |
.sort-radio input:checked + label {
|
698 |
background: linear-gradient(135deg, #7b61ff, #6366f1);
|
699 |
color: white;
|
700 |
border-color: transparent;
|
701 |
}
|
|
|
702 |
/* ๋ฆฌํ๋ ์ ๋ฒํผ ์คํ์ผ ์์ */
|
703 |
.refresh-btn {
|
704 |
background: linear-gradient(135deg, #7b61ff, #6366f1);
|
@@ -721,17 +758,7 @@ def create_interface():
|
|
721 |
box-shadow: 0 4px 12px rgba(99,102,241,0.4);
|
722 |
background: linear-gradient(135deg, #8b71ff, #7376f1);
|
723 |
}
|
724 |
-
|
725 |
-
.sort-radio > div {
|
726 |
-
display: flex !important;
|
727 |
-
gap: 10px !important;
|
728 |
-
width: 100% !important;
|
729 |
-
}
|
730 |
-
/* ๋ผ๋์ค ๋ฒํผ ํญ๋ชฉ ๊ฐ์ ์คํ์ผ */
|
731 |
-
.sort-radio > div > div {
|
732 |
-
flex: 1 !important;
|
733 |
-
min-width: 100px !important;
|
734 |
-
}
|
735 |
""") as interface:
|
736 |
|
737 |
gr.Markdown("""
|
|
|
246 |
likes = format(item.get('likes', 0), ',')
|
247 |
created = item.get('createdAt', '').split('T')[0]
|
248 |
|
249 |
+
# short_description ๊ฐ์ ธ์ค๊ธฐ
|
250 |
+
short_description = item.get('cardData', {}).get('short_description', '')
|
251 |
+
|
252 |
+
# title๊ณผ short_description์ ํฌํจํ ํค๋ HTML
|
253 |
+
title_html = f"""
|
254 |
+
<h3 style='
|
255 |
+
margin: 0 0 15px 0;
|
256 |
+
color: #333;
|
257 |
+
font-size: 1.3em;
|
258 |
+
line-height: 1.4;
|
259 |
+
display: -webkit-box;
|
260 |
+
-webkit-line-clamp: 2;
|
261 |
+
-webkit-box-orient: vertical;
|
262 |
+
overflow: hidden;
|
263 |
+
text-overflow: ellipsis;
|
264 |
+
text-shadow: 1px 1px 1px rgba(255,255,255,0.8);'>
|
265 |
+
{title}
|
266 |
+
{f'<span style="display: block; font-size: 0.7em; color: #666; margin-top: 5px; font-weight: normal; font-style: italic;">{short_description}</span>' if short_description else ''}
|
267 |
+
</h3>
|
268 |
+
"""
|
269 |
+
|
270 |
+
|
271 |
# URL ์ ์
|
272 |
if card_type == "space":
|
273 |
url = f"https://huggingface.co/spaces/{item_id}"
|
|
|
686 |
box-shadow: 0 0 0 2px rgba(123,97,255,0.2);
|
687 |
background: linear-gradient(135deg, #ffffff, #f0f3ff);
|
688 |
}
|
689 |
+
/* ์ ๋ ฌ ๋ผ๋์ค ๋ฒํผ ์ปจํ
์ด๋ ์์ */
|
690 |
.sort-radio {
|
691 |
display: flex !important;
|
692 |
+
justify-content: flex-start !important;
|
693 |
gap: 10px !important;
|
694 |
background: linear-gradient(135deg, #f5f5ff, #f0f0ff);
|
695 |
padding: 12px;
|
696 |
border-radius: 10px;
|
697 |
+
width: 100% !important;
|
698 |
+
}
|
699 |
+
|
700 |
+
/* ๋ผ๋์ค ๋ฒํผ ๊ทธ๋ฃน ์ปจํ
์ด๋ ์์ */
|
701 |
+
.sort-radio > div {
|
702 |
+
display: flex !important;
|
703 |
+
gap: 10px !important;
|
704 |
+
width: auto !important;
|
705 |
+
}
|
706 |
+
|
707 |
+
/* ๊ฐ ๋ผ๋์ค ๋ฒํผ ํญ๋ชฉ ์์ */
|
708 |
+
.sort-radio > div > div {
|
709 |
+
width: 100px !important; /* ๊ณ ์ ๋๋น ์ค์ */
|
710 |
+
flex: none !important; /* flex ์ฑ์ฅ ๋ฐฉ์ง */
|
711 |
}
|
712 |
+
|
713 |
+
/* ๋ผ๋์ค ๋ฒํผ ๋ ์ด๋ธ ์์ */
|
714 |
.sort-radio label {
|
715 |
+
width: 100px !important; /* ๊ณ ์ ๋๋น ์ค์ */
|
716 |
+
padding: 8px 5px !important;
|
717 |
text-align: center !important;
|
|
|
718 |
background: linear-gradient(135deg, #ffffff, #f8f9ff);
|
719 |
border-radius: 8px;
|
720 |
cursor: pointer;
|
721 |
transition: all 0.3s ease;
|
722 |
border: 1px solid rgba(123,97,255,0.1);
|
723 |
+
white-space: nowrap !important;
|
724 |
+
font-size: 0.9em !important;
|
725 |
+
display: block !important;
|
726 |
}
|
727 |
+
|
728 |
.sort-radio label:hover {
|
729 |
background: linear-gradient(135deg, #f0f3ff, #e8ecff);
|
730 |
border-color: rgba(123,97,255,0.3);
|
731 |
}
|
732 |
+
|
733 |
.sort-radio input:checked + label {
|
734 |
background: linear-gradient(135deg, #7b61ff, #6366f1);
|
735 |
color: white;
|
736 |
border-color: transparent;
|
737 |
}
|
738 |
+
|
739 |
/* ๋ฆฌํ๋ ์ ๋ฒํผ ์คํ์ผ ์์ */
|
740 |
.refresh-btn {
|
741 |
background: linear-gradient(135deg, #7b61ff, #6366f1);
|
|
|
758 |
box-shadow: 0 4px 12px rgba(99,102,241,0.4);
|
759 |
background: linear-gradient(135deg, #8b71ff, #7376f1);
|
760 |
}
|
761 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
""") as interface:
|
763 |
|
764 |
gr.Markdown("""
|