Update app.py
Browse files
app.py
CHANGED
@@ -298,13 +298,15 @@ def get_models_data(progress=gr.Progress()):
|
|
298 |
"""๋ชจ๋ธ ID๋ฅผ ์ ๊ทํ"""
|
299 |
return model_id.strip().lower()
|
300 |
|
301 |
-
url = "https://huggingface.co/api/models
|
302 |
|
303 |
try:
|
304 |
progress(0, desc="Fetching models data...")
|
305 |
params = {
|
306 |
'full': 'true',
|
307 |
-
'limit': 3000
|
|
|
|
|
308 |
}
|
309 |
|
310 |
headers = {'Accept': 'application/json'}
|
@@ -317,7 +319,7 @@ def get_models_data(progress=gr.Progress()):
|
|
317 |
|
318 |
models = response.json()
|
319 |
|
320 |
-
# ์ ์ฒด ์์ ์ ๋ณด ์ ์ฅ
|
321 |
model_ranks = {}
|
322 |
model_data = {} # ๋ชจ๋ ๋ชจ๋ธ์ ์์ธ ๋ฐ์ดํฐ ์ ์ฅ
|
323 |
|
@@ -345,20 +347,16 @@ def get_models_data(progress=gr.Progress()):
|
|
345 |
else:
|
346 |
model_info = {
|
347 |
'id': target_id,
|
348 |
-
'rank': 'Not in
|
349 |
'downloads': 'N/A',
|
350 |
'likes': 'N/A',
|
351 |
'title': 'No Title'
|
352 |
}
|
353 |
filtered_models.append(model_info)
|
354 |
|
355 |
-
#
|
356 |
-
filtered_models.sort(key=lambda x: float('inf') if x['rank'] == 'Not in
|
357 |
-
|
358 |
-
# ์์๋ก ์ ๋ ฌ (์์๊ฐ ์ซ์์ธ ๊ฒฝ์ฐ๋ง)
|
359 |
-
filtered_models.sort(key=lambda x: (
|
360 |
-
float('inf') if x['rank'] == 'Not in top 3000' else x['rank']
|
361 |
-
))
|
362 |
|
363 |
if not filtered_models:
|
364 |
return create_error_plot(), "<div>์ ํ๋ ๋ชจ๋ธ์ ๋ฐ์ดํฐ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.</div>", pd.DataFrame()
|
|
|
298 |
"""๋ชจ๋ธ ID๋ฅผ ์ ๊ทํ"""
|
299 |
return model_id.strip().lower()
|
300 |
|
301 |
+
url = "https://huggingface.co/api/models" # ์ผ๋ฐ API ์ฌ์ฉ
|
302 |
|
303 |
try:
|
304 |
progress(0, desc="Fetching models data...")
|
305 |
params = {
|
306 |
'full': 'true',
|
307 |
+
'limit': 3000,
|
308 |
+
'sort': 'lastModified', # ์ต์ ์์ ์์ผ๋ก ์ ๋ ฌ
|
309 |
+
'direction': -1
|
310 |
}
|
311 |
|
312 |
headers = {'Accept': 'application/json'}
|
|
|
319 |
|
320 |
models = response.json()
|
321 |
|
322 |
+
# ์ ์ฒด ์์ ์ ๋ณด ์ ์ฅ
|
323 |
model_ranks = {}
|
324 |
model_data = {} # ๋ชจ๋ ๋ชจ๋ธ์ ์์ธ ๋ฐ์ดํฐ ์ ์ฅ
|
325 |
|
|
|
347 |
else:
|
348 |
model_info = {
|
349 |
'id': target_id,
|
350 |
+
'rank': 'Not in top 3000',
|
351 |
'downloads': 'N/A',
|
352 |
'likes': 'N/A',
|
353 |
'title': 'No Title'
|
354 |
}
|
355 |
filtered_models.append(model_info)
|
356 |
|
357 |
+
# ์์๋ก ์ ๋ ฌ
|
358 |
+
filtered_models.sort(key=lambda x: float('inf') if x['rank'] == 'Not in top 3000' else x['rank'])
|
359 |
+
|
|
|
|
|
|
|
|
|
360 |
|
361 |
if not filtered_models:
|
362 |
return create_error_plot(), "<div>์ ํ๋ ๋ชจ๋ธ์ ๋ฐ์ดํฐ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.</div>", pd.DataFrame()
|