openfree commited on
Commit
270a16a
โ€ข
1 Parent(s): 2d4a3da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -2
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}