Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,6 +85,29 @@ def take_screenshot(url):
|
|
85 |
if 'driver' in locals():
|
86 |
driver.quit()
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
89 |
"""ํตํฉ ์นด๋ HTML ์์ฑ"""
|
90 |
item_id = item.get('id', '')
|
@@ -168,6 +191,9 @@ def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
|
168 |
|
169 |
|
170 |
|
|
|
|
|
|
|
171 |
# ํ๋์จ์ด ์ ๋ณด HTML
|
172 |
hardware_info = f"""
|
173 |
<div style='
|
@@ -182,11 +208,9 @@ def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
|
182 |
gap: 10px;'>
|
183 |
<div style='color: #444;'>
|
184 |
<span style='margin-right: 5px;'>๐ป</span> CPU: {cpu_info}
|
185 |
-
|
186 |
</div>
|
187 |
<div style='color: #444;'>
|
188 |
<span style='margin-right: 5px;'>๐ฎ</span> GPU: {gpu_info}
|
189 |
-
|
190 |
</div>
|
191 |
<div style='color: #444;'>
|
192 |
<span style='margin-right: 5px;'>๐ ๏ธ</span> SDK: {sdk}
|
|
|
85 |
if 'driver' in locals():
|
86 |
driver.quit()
|
87 |
|
88 |
+
def get_hardware_info(item: dict) -> tuple:
|
89 |
+
"""ํ๋์จ์ด ์ ๋ณด ์ถ์ถ"""
|
90 |
+
hardware = item.get('hardware', {})
|
91 |
+
|
92 |
+
# CPU ์ ๋ณด ์ฒ๋ฆฌ
|
93 |
+
cpu_info = hardware.get('cpu', 'Standard')
|
94 |
+
|
95 |
+
# GPU ์ ๋ณด ์ฒ๋ฆฌ
|
96 |
+
gpu_info = hardware.get('gpu', {})
|
97 |
+
if isinstance(gpu_info, dict):
|
98 |
+
gpu_name = gpu_info.get('name', '')
|
99 |
+
gpu_memory = gpu_info.get('memory', '')
|
100 |
+
gpu_info = f"{gpu_name} ({gpu_memory}GB)" if gpu_name and gpu_memory else "None"
|
101 |
+
elif isinstance(gpu_info, str):
|
102 |
+
gpu_info = gpu_info if gpu_info else "None"
|
103 |
+
else:
|
104 |
+
gpu_info = "None"
|
105 |
+
|
106 |
+
# SDK ์ ๋ณด ์ฒ๋ฆฌ
|
107 |
+
sdk = item.get('sdk', 'N/A')
|
108 |
+
|
109 |
+
return cpu_info, gpu_info, sdk
|
110 |
+
|
111 |
def get_card(item: dict, index: int, card_type: str = "space") -> str:
|
112 |
"""ํตํฉ ์นด๋ HTML ์์ฑ"""
|
113 |
item_id = item.get('id', '')
|
|
|
191 |
|
192 |
|
193 |
|
194 |
+
# ํ๋์จ์ด ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ
|
195 |
+
cpu_info, gpu_info, sdk = get_hardware_info(item)
|
196 |
+
|
197 |
# ํ๋์จ์ด ์ ๋ณด HTML
|
198 |
hardware_info = f"""
|
199 |
<div style='
|
|
|
208 |
gap: 10px;'>
|
209 |
<div style='color: #444;'>
|
210 |
<span style='margin-right: 5px;'>๐ป</span> CPU: {cpu_info}
|
|
|
211 |
</div>
|
212 |
<div style='color: #444;'>
|
213 |
<span style='margin-right: 5px;'>๐ฎ</span> GPU: {gpu_info}
|
|
|
214 |
</div>
|
215 |
<div style='color: #444;'>
|
216 |
<span style='margin-right: 5px;'>๐ ๏ธ</span> SDK: {sdk}
|