Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -223,23 +223,38 @@ def get_vercel_deployments():
|
|
223 |
print(f"Error fetching Vercel deployments: {str(e)}")
|
224 |
return []
|
225 |
|
|
|
226 |
def get_vercel_card(deployment, index):
|
227 |
"""Generate HTML card for a Vercel deployment with like button"""
|
228 |
raw_url = deployment.get('url', '')
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
created = format_timestamp(deployment.get('created'))
|
233 |
name = deployment.get('name', 'Unnamed Project')
|
234 |
state = deployment.get('state', 'N/A')
|
235 |
|
236 |
# ๊ณ ์ ID ์์ฑ (์นด๋ ์๋ณ์ฉ)
|
237 |
-
card_id = f"vercel-card-{
|
|
|
|
|
238 |
|
239 |
bg_color = get_pastel_color(index + 20)
|
240 |
tech_emojis = ['โก', '๐', '๐', 'โจ', '๐ซ', '๐ฅ', '๐', '๐ฏ', '๐จ', '๐ฎ']
|
241 |
random_emojis = random.sample(tech_emojis, 3)
|
242 |
-
|
|
|
243 |
return f"""
|
244 |
<div id="{card_id}" class="vercel-card"
|
245 |
data-likes="0"
|
@@ -254,28 +269,21 @@ def get_vercel_card(deployment, index):
|
|
254 |
overflow: hidden;'
|
255 |
onmouseover='this.style.transform="translateY(-5px) scale(1.02)"; this.style.boxShadow="0 8px 25px rgba(0,0,0,0.15)"'
|
256 |
onmouseout='this.style.transform="translateY(0) scale(1)"; this.style.boxShadow="0 4px 15px rgba(0,0,0,0.1)"'>
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
<span style='font-size: 1.3em'>{random_emojis[0]}</span>
|
273 |
-
<a href='https://{url}' target='_blank'
|
274 |
-
style='text-decoration: none; color: #2d2d2d;'>
|
275 |
-
{name}
|
276 |
-
</a>
|
277 |
-
<span style='font-size: 1.3em'>{random_emojis[1]}</span>
|
278 |
-
</h3>
|
279 |
<div style='margin: 15px 0; color: #444; background: rgba(255,255,255,0.5);
|
280 |
padding: 15px; border-radius: 12px;'>
|
281 |
<p style='margin: 8px 0;'>
|
@@ -288,31 +296,31 @@ def get_vercel_card(deployment, index):
|
|
288 |
<strong>URL:</strong> ๐ https://{url}
|
289 |
</p>
|
290 |
</div>
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
</div>
|
317 |
"""
|
318 |
|
|
|
223 |
print(f"Error fetching Vercel deployments: {str(e)}")
|
224 |
return []
|
225 |
|
226 |
+
|
227 |
def get_vercel_card(deployment, index):
|
228 |
"""Generate HTML card for a Vercel deployment with like button"""
|
229 |
raw_url = deployment.get('url', '')
|
230 |
+
|
231 |
+
# URL ์ฒ๋ฆฌ ๋ก์ง ์์
|
232 |
+
if raw_url.startswith('http'):
|
233 |
+
url = raw_url # ์ ์ฒด URL์ด ์ ๊ณต๋ ๊ฒฝ์ฐ ๊ทธ๋๋ก ์ฌ์ฉ
|
234 |
+
else:
|
235 |
+
project_name = raw_url[:6] if len(raw_url) >= 6 else raw_url
|
236 |
+
url = f"{project_name}.vercel.app"
|
237 |
+
|
238 |
+
# Hugging Face ์คํ์ด์ค URL์ธ ๊ฒฝ์ฐ ์ง์ ์ฌ์ฉ
|
239 |
+
if 'huggingface.co' in url:
|
240 |
+
final_url = url
|
241 |
+
else:
|
242 |
+
final_url = f"https://{url}" if not url.startswith('http') else url
|
243 |
|
244 |
created = format_timestamp(deployment.get('created'))
|
245 |
name = deployment.get('name', 'Unnamed Project')
|
246 |
state = deployment.get('state', 'N/A')
|
247 |
|
248 |
# ๊ณ ์ ID ์์ฑ (์นด๋ ์๋ณ์ฉ)
|
249 |
+
card_id = f"vercel-card-{url.replace('.', '-').replace('/', '-')}"
|
250 |
+
|
251 |
+
|
252 |
|
253 |
bg_color = get_pastel_color(index + 20)
|
254 |
tech_emojis = ['โก', '๐', '๐', 'โจ', '๐ซ', '๐ฅ', '๐', '๐ฏ', '๐จ', '๐ฎ']
|
255 |
random_emojis = random.sample(tech_emojis, 3)
|
256 |
+
|
257 |
+
|
258 |
return f"""
|
259 |
<div id="{card_id}" class="vercel-card"
|
260 |
data-likes="0"
|
|
|
269 |
overflow: hidden;'
|
270 |
onmouseover='this.style.transform="translateY(-5px) scale(1.02)"; this.style.boxShadow="0 8px 25px rgba(0,0,0,0.15)"'
|
271 |
onmouseout='this.style.transform="translateY(0) scale(1)"; this.style.boxShadow="0 4px 15px rgba(0,0,0,0.1)"'>
|
272 |
+
<!-- ... (์ด์ ์ฝ๋์ ๋์ผ) ... -->
|
273 |
+
<h3 style='color: #2d2d2d;
|
274 |
+
margin: 0 0 20px 0;
|
275 |
+
font-size: 1.4em;
|
276 |
+
display: flex;
|
277 |
+
align-items: center;
|
278 |
+
gap: 10px;'>
|
279 |
+
<span style='font-size: 1.3em'>{random_emojis[0]}</span>
|
280 |
+
<a href='{final_url}' target='_blank'
|
281 |
+
style='text-decoration: none; color: #2d2d2d;'>
|
282 |
+
{name}
|
283 |
+
</a>
|
284 |
+
<span style='font-size: 1.3em'>{random_emojis[1]}</span>
|
285 |
+
</h3>
|
286 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
<div style='margin: 15px 0; color: #444; background: rgba(255,255,255,0.5);
|
288 |
padding: 15px; border-radius: 12px;'>
|
289 |
<p style='margin: 8px 0;'>
|
|
|
296 |
<strong>URL:</strong> ๐ https://{url}
|
297 |
</p>
|
298 |
</div>
|
299 |
+
<div style='margin-top: 20px; display: flex; justify-content: space-between; align-items: center;'>
|
300 |
+
<div class="like-section" style="display: flex; align-items: center; gap: 10px;">
|
301 |
+
<button onclick="toggleLike('{card_id}')" class="like-button"
|
302 |
+
style="background: none; border: none; cursor: pointer; font-size: 1.5em; padding: 5px 10px;">
|
303 |
+
๐ค
|
304 |
+
</button>
|
305 |
+
<span class="like-count" style="font-size: 1.2em; color: #666;">0</span>
|
306 |
+
</div>
|
307 |
+
<a href='{final_url}' target='_blank'
|
308 |
+
style='background: linear-gradient(45deg, #0084ff, #00a3ff);
|
309 |
+
color: white;
|
310 |
+
padding: 10px 20px;
|
311 |
+
border-radius: 15px;
|
312 |
+
text-decoration: none;
|
313 |
+
display: inline-flex;
|
314 |
+
align-items: center;
|
315 |
+
gap: 8px;
|
316 |
+
font-weight: 500;
|
317 |
+
transition: all 0.3s;
|
318 |
+
box-shadow: 0 2px 8px rgba(0,132,255,0.3);'
|
319 |
+
onmouseover='this.style.transform="scale(1.05)"; this.style.boxShadow="0 4px 12px rgba(0,132,255,0.4)"'
|
320 |
+
onmouseout='this.style.transform="scale(1)"; this.style.boxShadow="0 2px 8px rgba(0,132,255,0.3)"'>
|
321 |
+
<span>View Deployment</span> ๐ {random_emojis[0]}
|
322 |
+
</a>
|
323 |
+
</div>
|
324 |
</div>
|
325 |
"""
|
326 |
|