openfree commited on
Commit
ba159ad
·
verified ·
1 Parent(s): 0a42d1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -48
app.py CHANGED
@@ -115,53 +115,58 @@ def get_card(item: dict, index: int, card_type: str = "space") -> str:
115
  gpu_memory = gpu_info.get('memory', 'N/A')
116
  gpu_info = f"{gpu_type} ({gpu_memory}GB)"
117
 
118
- # 카드 타입별 그라데이션 설정
119
- if card_type == "space":
120
- gradient_colors = """
121
- rgba(255, 182, 193, 0.7), /* 파스텔 핑크 */
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
- content_bg = f"""
131
- background: linear-gradient(135deg, {gradient_colors});
132
- backdrop-filter: blur(10px);
133
- """
134
- elif card_type == "model":
135
- gradient_colors = """
136
- rgba(110, 142, 251, 0.7), /* 모델 블루 */
137
- rgba(130, 158, 251, 0.7),
138
- rgba(150, 174, 251, 0.7)
139
- """
140
- bg_content = f"""
141
- background: linear-gradient(135deg, #6e8efb, #4a6cf7);
142
- padding: 15px;
143
- """
144
- content_bg = f"""
145
- background: linear-gradient(135deg, {gradient_colors});
146
- backdrop-filter: blur(10px);
147
- """
148
- else: # dataset
149
- gradient_colors = """
150
- rgba(255, 107, 107, 0.7), /* 데이터셋 레드 */
151
- rgba(255, 127, 127, 0.7),
152
- rgba(255, 147, 147, 0.7)
153
- """
154
- bg_content = f"""
155
- background: linear-gradient(135deg, #ff6b6b, #ff8787);
156
- padding: 15px;
157
- """
158
- content_bg = f"""
159
- background: linear-gradient(135deg, {gradient_colors});
160
- backdrop-filter: blur(10px);
161
- """
162
-
 
 
 
 
 
163
 
164
- # 하드웨어 정보 HTML (모든 카드 타입에 대해 동일하게 적용)
165
  hardware_info = f"""
166
  <div style='
167
  margin-top: 15px;
@@ -187,6 +192,7 @@ else: # dataset
187
  """
188
 
189
  # 태그 표시 (models와 datasets용)
 
190
  if card_type != "space":
191
  tags_html = f"""
192
  <div style='
@@ -211,9 +217,8 @@ else: # dataset
211
  ''' for tag in tags[:5]])}
212
  </div>
213
  """
214
- else:
215
- tags_html = ""
216
 
 
217
  return f"""
218
  <div class="card" style='
219
  position: relative;
 
115
  gpu_memory = gpu_info.get('memory', 'N/A')
116
  gpu_info = f"{gpu_type} ({gpu_memory}GB)"
117
 
118
+ # 카드 타입별 그라데이션 설정
119
+ if card_type == "space":
120
+ gradient_colors = """
121
+ rgba(255, 182, 193, 0.7), /* 파스텔 핑크 */
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
+ content_bg = f"""
131
+ background: linear-gradient(135deg, {gradient_colors});
132
+ backdrop-filter: blur(10px);
133
+ """
134
+ type_icon = "🎯"
135
+ type_label = "SPACE"
136
+ elif card_type == "model":
137
+ gradient_colors = """
138
+ rgba(110, 142, 251, 0.7), /* 모델 블루 */
139
+ rgba(130, 158, 251, 0.7),
140
+ rgba(150, 174, 251, 0.7)
141
+ """
142
+ bg_content = f"""
143
+ background: linear-gradient(135deg, #6e8efb, #4a6cf7);
144
+ padding: 15px;
145
+ """
146
+ content_bg = f"""
147
+ background: linear-gradient(135deg, {gradient_colors});
148
+ backdrop-filter: blur(10px);
149
+ """
150
+ type_icon = "🤖"
151
+ type_label = "MODEL"
152
+ else: # dataset
153
+ gradient_colors = """
154
+ rgba(255, 107, 107, 0.7), /* 데이터셋 레드 */
155
+ rgba(255, 127, 127, 0.7),
156
+ rgba(255, 147, 147, 0.7)
157
+ """
158
+ bg_content = f"""
159
+ background: linear-gradient(135deg, #ff6b6b, #ff8787);
160
+ padding: 15px;
161
+ """
162
+ content_bg = f"""
163
+ background: linear-gradient(135deg, {gradient_colors});
164
+ backdrop-filter: blur(10px);
165
+ """
166
+ type_icon = "📊"
167
+ type_label = "DATASET"
168
 
169
+ # 하드웨어 정보 HTML
170
  hardware_info = f"""
171
  <div style='
172
  margin-top: 15px;
 
192
  """
193
 
194
  # 태그 표시 (models와 datasets용)
195
+ tags_html = ""
196
  if card_type != "space":
197
  tags_html = f"""
198
  <div style='
 
217
  ''' for tag in tags[:5]])}
218
  </div>
219
  """
 
 
220
 
221
+ # 카드 HTML 반환
222
  return f"""
223
  <div class="card" style='
224
  position: relative;