Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
from datetime import datetime
|
|
|
4 |
|
5 |
USERNAME = "openfree"
|
6 |
|
@@ -10,7 +11,33 @@ def format_timestamp(timestamp):
|
|
10 |
return dt.strftime('%Y-%m-%d %H:%M')
|
11 |
return 'N/A'
|
12 |
|
13 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
"""Generate HTML card for a space with colorful design and lots of emojis"""
|
15 |
space_id = space.get('id', '')
|
16 |
space_name = space_id.split('/')[-1]
|
@@ -46,24 +73,13 @@ def get_space_card(space):
|
|
46 |
}
|
47 |
}
|
48 |
|
49 |
-
#
|
50 |
-
bg_colors = {
|
51 |
-
'gradio': '#FFE6E6', # μ°ν λΆν
|
52 |
-
'streamlit': '#E6FFE6', # μ°ν μ΄λ‘
|
53 |
-
'docker': '#E6E6FF', # μ°ν νλ
|
54 |
-
'static': '#FFE6FF', # μ°ν 보λΌ
|
55 |
-
'panel': '#FFFFE6', # μ°ν λ
Έλ
|
56 |
-
'N/A': '#E6FFFF' # μ°ν νλ
|
57 |
-
}
|
58 |
-
|
59 |
-
# SDKμ λ°λ₯Έ μ΄λͺ¨μ§μ μμ μ ν
|
60 |
sdk_lower = sdk.lower()
|
61 |
-
bg_color =
|
62 |
emoji_set = sdk_emoji_sets.get(sdk_lower, sdk_emoji_sets['N/A'])
|
63 |
main_emoji = emoji_set['main']
|
64 |
|
65 |
# λλ€νκ² 3κ°μ κ΄λ ¨ μ΄λͺ¨μ§ μ ν
|
66 |
-
import random
|
67 |
decorative_emojis = random.sample(emoji_set['related'], 3)
|
68 |
|
69 |
# μΆκ° μ₯μμ© μ΄λͺ¨μ§
|
@@ -190,7 +206,7 @@ def get_user_spaces():
|
|
190 |
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
191 |
gap: 20px;
|
192 |
'>
|
193 |
-
{"".join(get_space_card(space) for space in user_spaces)}
|
194 |
</div>
|
195 |
</div>
|
196 |
"""
|
|
|
1 |
import requests
|
2 |
import gradio as gr
|
3 |
from datetime import datetime
|
4 |
+
import random
|
5 |
|
6 |
USERNAME = "openfree"
|
7 |
|
|
|
11 |
return dt.strftime('%Y-%m-%d %H:%M')
|
12 |
return 'N/A'
|
13 |
|
14 |
+
def get_pastel_color(index):
|
15 |
+
"""Generate unique pastel colors based on index"""
|
16 |
+
pastel_colors = [
|
17 |
+
'#FFE6E6', # μ°ν λΆν
|
18 |
+
'#FFE6FF', # μ°ν 보λΌ
|
19 |
+
'#E6E6FF', # μ°ν νλ
|
20 |
+
'#E6FFFF', # μ°ν νλ
|
21 |
+
'#E6FFE6', # μ°ν μ΄λ‘
|
22 |
+
'#FFFFE6', # μ°ν λ
Έλ
|
23 |
+
'#FFF0E6', # μ°ν μ£Όν©
|
24 |
+
'#F0E6FF', # μ°ν λΌλ²€λ
|
25 |
+
'#FFE6F0', # μ°ν λ‘μ¦
|
26 |
+
'#E6FFF0', # μ°ν λ―ΌνΈ
|
27 |
+
'#F0FFE6', # μ°ν λΌμ
|
28 |
+
'#FFE6EB', # μ°ν μ½λ
|
29 |
+
'#E6EBFF', # μ°ν νΌνλΈλ£¨
|
30 |
+
'#FFE6F5', # μ°ν νν¬
|
31 |
+
'#E6FFF5', # μ°ν ν°μ½μ΄μ¦
|
32 |
+
'#F5E6FF', # μ°ν λͺ¨λΈ
|
33 |
+
'#FFE6EC', # μ°ν μ΄λͺ¬
|
34 |
+
'#E6FFEC', # μ°ν μ€νλ§κ·Έλ¦°
|
35 |
+
'#ECE6FF', # μ°ν ν리μν΄
|
36 |
+
'#FFE6F7', # μ°ν 맀그λ리μ
|
37 |
+
]
|
38 |
+
return pastel_colors[index % len(pastel_colors)]
|
39 |
+
|
40 |
+
def get_space_card(space, index):
|
41 |
"""Generate HTML card for a space with colorful design and lots of emojis"""
|
42 |
space_id = space.get('id', '')
|
43 |
space_name = space_id.split('/')[-1]
|
|
|
73 |
}
|
74 |
}
|
75 |
|
76 |
+
# SDKμ λ°λ₯Έ μ΄λͺ¨μ§ μ ν
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
sdk_lower = sdk.lower()
|
78 |
+
bg_color = get_pastel_color(index) # μΈλ±μ€ κΈ°λ° μμ μ ν
|
79 |
emoji_set = sdk_emoji_sets.get(sdk_lower, sdk_emoji_sets['N/A'])
|
80 |
main_emoji = emoji_set['main']
|
81 |
|
82 |
# λλ€νκ² 3κ°μ κ΄λ ¨ μ΄λͺ¨μ§ μ ν
|
|
|
83 |
decorative_emojis = random.sample(emoji_set['related'], 3)
|
84 |
|
85 |
# μΆκ° μ₯μμ© μ΄λͺ¨μ§
|
|
|
206 |
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
207 |
gap: 20px;
|
208 |
'>
|
209 |
+
{"".join(get_space_card(space, idx) for idx, space in enumerate(user_spaces))}
|
210 |
</div>
|
211 |
</div>
|
212 |
"""
|