Spaces:
Build error
Build error
Colin Dablain
commited on
Commit
•
3baa389
1
Parent(s):
fb55900
feat: factor out HF_API_ROOT to allow different inference endpoints (#332)
Browse files- .env +1 -0
- src/lib/server/modelEndpoint.ts +2 -2
.env
CHANGED
@@ -7,6 +7,7 @@ MONGODB_DIRECT_CONNECTION=false
|
|
7 |
|
8 |
COOKIE_NAME=hf-chat
|
9 |
HF_ACCESS_TOKEN=#hf_<token> from from https://huggingface.co/settings/token
|
|
|
10 |
|
11 |
# used to activate search with web functionality. disabled if none are defined. choose one of the following:
|
12 |
SERPER_API_KEY=#your serper.dev api key here
|
|
|
7 |
|
8 |
COOKIE_NAME=hf-chat
|
9 |
HF_ACCESS_TOKEN=#hf_<token> from from https://huggingface.co/settings/token
|
10 |
+
HF_API_ROOT=https://api-inference.huggingface.co/models
|
11 |
|
12 |
# used to activate search with web functionality. disabled if none are defined. choose one of the following:
|
13 |
SERPER_API_KEY=#your serper.dev api key here
|
src/lib/server/modelEndpoint.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import { HF_ACCESS_TOKEN } from "$env/static/private";
|
2 |
import { sum } from "$lib/utils/sum";
|
3 |
import type { BackendModel } from "./models";
|
4 |
|
@@ -12,7 +12,7 @@ export function modelEndpoint(model: BackendModel): {
|
|
12 |
} {
|
13 |
if (!model.endpoints) {
|
14 |
return {
|
15 |
-
url:
|
16 |
authorization: `Bearer ${HF_ACCESS_TOKEN}`,
|
17 |
weight: 1,
|
18 |
};
|
|
|
1 |
+
import { HF_ACCESS_TOKEN, HF_API_ROOT } from "$env/static/private";
|
2 |
import { sum } from "$lib/utils/sum";
|
3 |
import type { BackendModel } from "./models";
|
4 |
|
|
|
12 |
} {
|
13 |
if (!model.endpoints) {
|
14 |
return {
|
15 |
+
url: `${HF_API_ROOT}/${model.name}`,
|
16 |
authorization: `Bearer ${HF_ACCESS_TOKEN}`,
|
17 |
weight: 1,
|
18 |
};
|