Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix total model count
Browse files
frontend/src/pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext.js
CHANGED
@@ -77,10 +77,19 @@ const initialState = {
|
|
77 |
},
|
78 |
};
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
// Function to check if a parameter count is within a range
|
81 |
const isInParamRange = (params, range) => {
|
82 |
if (range[0] === -1 && range[1] === 140) return true;
|
83 |
-
|
|
|
|
|
84 |
};
|
85 |
|
86 |
// Function to check if a model matches filter criteria
|
|
|
77 |
},
|
78 |
};
|
79 |
|
80 |
+
// Function to normalize parameter value
|
81 |
+
const normalizeParams = (params) => {
|
82 |
+
const numParams = Number(params);
|
83 |
+
if (isNaN(numParams)) return null;
|
84 |
+
return Math.round(numParams * 100) / 100;
|
85 |
+
};
|
86 |
+
|
87 |
// Function to check if a parameter count is within a range
|
88 |
const isInParamRange = (params, range) => {
|
89 |
if (range[0] === -1 && range[1] === 140) return true;
|
90 |
+
const normalizedParams = normalizeParams(params);
|
91 |
+
if (normalizedParams === null) return false;
|
92 |
+
return normalizedParams >= range[0] && normalizedParams < range[1];
|
93 |
};
|
94 |
|
95 |
// Function to check if a model matches filter criteria
|