Spaces:
Running
Running
Kevin CATHALY
commited on
Commit
•
c265074
1
Parent(s):
815e76f
return only valid models in the API (#1064)
Browse files- src/routes/api/models/+server.ts +18 -16
src/routes/api/models/+server.ts
CHANGED
@@ -1,21 +1,23 @@
|
|
1 |
import { models } from "$lib/server/models";
|
2 |
|
3 |
export async function GET() {
|
4 |
-
const res = models
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
return Response.json(res);
|
21 |
}
|
|
|
1 |
import { models } from "$lib/server/models";
|
2 |
|
3 |
export async function GET() {
|
4 |
+
const res = models
|
5 |
+
.filter((m) => m.unlisted == false)
|
6 |
+
.map((model) => ({
|
7 |
+
id: model.id,
|
8 |
+
name: model.name,
|
9 |
+
websiteUrl: model.websiteUrl ?? "https://huggingface.co",
|
10 |
+
modelUrl: model.modelUrl ?? "https://huggingface.co",
|
11 |
+
tokenizer: model.tokenizer,
|
12 |
+
datasetName: model.datasetName,
|
13 |
+
datasetUrl: model.datasetUrl,
|
14 |
+
displayName: model.displayName,
|
15 |
+
description: model.description ?? "",
|
16 |
+
logoUrl: model.logoUrl,
|
17 |
+
promptExamples: model.promptExamples ?? [],
|
18 |
+
preprompt: model.preprompt ?? "",
|
19 |
+
multimodal: model.multimodal ?? false,
|
20 |
+
unlisted: model.unlisted ?? false,
|
21 |
+
}));
|
22 |
return Response.json(res);
|
23 |
}
|