Daniel Kantor
commited on
Commit
·
92b57b8
1
Parent(s):
cd1301d
correctly show "no models found" message when dataset is empty
Browse files
backend/app/services/leaderboard.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
from app.core.cache import cache_config
|
2 |
from typing import List, Dict, Any
|
3 |
import datasets
|
4 |
-
from fastapi import HTTPException
|
5 |
import logging
|
6 |
from app.config.base import HF_ORGANIZATION
|
7 |
from app.core.formatting import LogFormatter
|
@@ -42,7 +41,9 @@ class LeaderboardService:
|
|
42 |
|
43 |
except Exception as e:
|
44 |
logger.error(LogFormatter.error("Failed to fetch leaderboard data", e))
|
45 |
-
|
|
|
|
|
46 |
|
47 |
async def get_formatted_data(self) -> List[Dict[str, Any]]:
|
48 |
"""Get formatted leaderboard data"""
|
@@ -104,7 +105,9 @@ class LeaderboardService:
|
|
104 |
|
105 |
except Exception as e:
|
106 |
logger.error(LogFormatter.error("Failed to format leaderboard data", e))
|
107 |
-
|
|
|
|
|
108 |
|
109 |
async def transform_data(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
110 |
"""Transform raw data into the format expected by the frontend"""
|
|
|
1 |
from app.core.cache import cache_config
|
2 |
from typing import List, Dict, Any
|
3 |
import datasets
|
|
|
4 |
import logging
|
5 |
from app.config.base import HF_ORGANIZATION
|
6 |
from app.core.formatting import LogFormatter
|
|
|
41 |
|
42 |
except Exception as e:
|
43 |
logger.error(LogFormatter.error("Failed to fetch leaderboard data", e))
|
44 |
+
|
45 |
+
# Return fallback data when no results are available yet
|
46 |
+
return []
|
47 |
|
48 |
async def get_formatted_data(self) -> List[Dict[str, Any]]:
|
49 |
"""Get formatted leaderboard data"""
|
|
|
105 |
|
106 |
except Exception as e:
|
107 |
logger.error(LogFormatter.error("Failed to format leaderboard data", e))
|
108 |
+
|
109 |
+
# Return fallback data when no results are available yet
|
110 |
+
return []
|
111 |
|
112 |
async def transform_data(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
113 |
"""Transform raw data into the format expected by the frontend"""
|