Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Thomas G. Lopes
commited on
Commit
·
bf1aea7
1
Parent(s):
9281a4f
sort all models by trending score
Browse files
src/lib/state/models.svelte.ts
CHANGED
@@ -7,11 +7,13 @@ import { getModels, getRouterData, type RouterData } from "$lib/remote/models.re
|
|
7 |
|
8 |
const LOCAL_STORAGE_KEY = "hf_inference_playground_custom_models";
|
9 |
|
|
|
|
|
10 |
class Models {
|
11 |
routerData = $state<RouterData>();
|
12 |
remote: Model[] = $state([]);
|
13 |
-
trending = $derived(this.remote.toSorted(
|
14 |
-
nonTrending = $derived(this.remote.filter(m => !this.trending.includes(m)));
|
15 |
all = $derived([...this.remote, ...this.custom]);
|
16 |
|
17 |
constructor() {
|
|
|
7 |
|
8 |
const LOCAL_STORAGE_KEY = "hf_inference_playground_custom_models";
|
9 |
|
10 |
+
const trendingSort = (a: Model, b: Model) => b.trendingScore - a.trendingScore;
|
11 |
+
|
12 |
class Models {
|
13 |
routerData = $state<RouterData>();
|
14 |
remote: Model[] = $state([]);
|
15 |
+
trending = $derived(this.remote.toSorted(trendingSort).slice(0, 5));
|
16 |
+
nonTrending = $derived(this.remote.filter(m => !this.trending.includes(m)).toSorted(trendingSort));
|
17 |
all = $derived([...this.remote, ...this.custom]);
|
18 |
|
19 |
constructor() {
|