openfree commited on
Commit
51585e0
β€’
1 Parent(s): 3127fda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
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"""