Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -92,6 +92,14 @@ def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
|
92 |
likes = format(item.get('likes', 0), ',')
|
93 |
created = item.get('createdAt', '').split('T')[0]
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
# λ©νλ°μ΄ν° μ²λ¦¬
|
96 |
tags = item.get('tags', [])
|
97 |
pipeline_tag = item.get('pipeline_tag', '')
|
@@ -114,23 +122,33 @@ def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
|
114 |
rgba(173, 216, 230, 0.7), /* νμ€ν
λΈλ£¨ */
|
115 |
rgba(255, 218, 185, 0.7) /* νμ€ν
νΌμΉ */
|
116 |
"""
|
|
|
|
|
|
|
|
|
|
|
117 |
elif card_type == "model":
|
118 |
gradient_colors = """
|
119 |
rgba(110, 142, 251, 0.7), /* λͺ¨λΈ λΈλ£¨ */
|
120 |
rgba(130, 158, 251, 0.7),
|
121 |
rgba(150, 174, 251, 0.7)
|
122 |
"""
|
|
|
|
|
|
|
|
|
123 |
else: # dataset
|
124 |
gradient_colors = """
|
125 |
rgba(255, 107, 107, 0.7), /* λ°μ΄ν°μ
λ λ */
|
126 |
rgba(255, 127, 127, 0.7),
|
127 |
rgba(255, 147, 147, 0.7)
|
128 |
"""
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
-
content_bg = f"""
|
131 |
-
background: linear-gradient(135deg, {gradient_colors});
|
132 |
-
backdrop-filter: blur(10px);
|
133 |
-
"""
|
134 |
|
135 |
# νλμ¨μ΄ μ 보 HTML (λͺ¨λ μΉ΄λ νμ
μ λν΄ λμΌνκ² μ μ©)
|
136 |
hardware_info = f"""
|
|
|
92 |
likes = format(item.get('likes', 0), ',')
|
93 |
created = item.get('createdAt', '').split('T')[0]
|
94 |
|
95 |
+
# URL μ μ
|
96 |
+
if card_type == "space":
|
97 |
+
url = f"https://huggingface.co/spaces/{item_id}"
|
98 |
+
elif card_type == "model":
|
99 |
+
url = f"https://huggingface.co/{item_id}"
|
100 |
+
else: # dataset
|
101 |
+
url = f"https://huggingface.co/datasets/{item_id}"
|
102 |
+
|
103 |
# λ©νλ°μ΄ν° μ²λ¦¬
|
104 |
tags = item.get('tags', [])
|
105 |
pipeline_tag = item.get('pipeline_tag', '')
|
|
|
122 |
rgba(173, 216, 230, 0.7), /* νμ€ν
λΈλ£¨ */
|
123 |
rgba(255, 218, 185, 0.7) /* νμ€ν
νΌμΉ */
|
124 |
"""
|
125 |
+
bg_content = f"""
|
126 |
+
background-image: url(data:image/png;base64,{get_cached_screenshot(url) if get_cached_screenshot(url) else ''});
|
127 |
+
background-size: cover;
|
128 |
+
background-position: center;
|
129 |
+
"""
|
130 |
elif card_type == "model":
|
131 |
gradient_colors = """
|
132 |
rgba(110, 142, 251, 0.7), /* λͺ¨λΈ λΈλ£¨ */
|
133 |
rgba(130, 158, 251, 0.7),
|
134 |
rgba(150, 174, 251, 0.7)
|
135 |
"""
|
136 |
+
bg_content = f"""
|
137 |
+
background: linear-gradient(135deg, #6e8efb, #4a6cf7);
|
138 |
+
padding: 15px;
|
139 |
+
"""
|
140 |
else: # dataset
|
141 |
gradient_colors = """
|
142 |
rgba(255, 107, 107, 0.7), /* λ°μ΄ν°μ
λ λ */
|
143 |
rgba(255, 127, 127, 0.7),
|
144 |
rgba(255, 147, 147, 0.7)
|
145 |
"""
|
146 |
+
bg_content = f"""
|
147 |
+
background: linear-gradient(135deg, #ff6b6b, #ff8787);
|
148 |
+
padding: 15px;
|
149 |
+
"""
|
150 |
+
|
151 |
|
|
|
|
|
|
|
|
|
152 |
|
153 |
# νλμ¨μ΄ μ 보 HTML (λͺ¨λ μΉ΄λ νμ
μ λν΄ λμΌνκ² μ μ©)
|
154 |
hardware_info = f"""
|