Spaces:
Running
Running
✨ Switch to pure HF inference (#95)
Browse files
src/routes/conversation/[id]/+server.ts
CHANGED
|
@@ -32,7 +32,7 @@ export async function POST({ request, fetch, locals, params }) {
|
|
| 32 |
const resp = await fetch(PUBLIC_MODEL_ENDPOINT, {
|
| 33 |
headers: {
|
| 34 |
"Content-Type": request.headers.get("Content-Type") ?? "application/json",
|
| 35 |
-
Authorization: `
|
| 36 |
},
|
| 37 |
method: "POST",
|
| 38 |
body: JSON.stringify({
|
|
|
|
| 32 |
const resp = await fetch(PUBLIC_MODEL_ENDPOINT, {
|
| 33 |
headers: {
|
| 34 |
"Content-Type": request.headers.get("Content-Type") ?? "application/json",
|
| 35 |
+
Authorization: `Bearer ${HF_TOKEN}`,
|
| 36 |
},
|
| 37 |
method: "POST",
|
| 38 |
body: JSON.stringify({
|
src/routes/conversation/[id]/summarize/+server.ts
CHANGED
|
@@ -43,17 +43,9 @@ export async function POST({ params, locals, fetch }) {
|
|
| 43 |
model: PUBLIC_MODEL_ENDPOINT,
|
| 44 |
inputs: prompt,
|
| 45 |
parameters,
|
|
|
|
| 46 |
},
|
| 47 |
-
{
|
| 48 |
-
fetch: (url, options) =>
|
| 49 |
-
fetch(url, {
|
| 50 |
-
...options,
|
| 51 |
-
headers: {
|
| 52 |
-
...options?.headers,
|
| 53 |
-
Authorization: `Basic ${HF_TOKEN}`,
|
| 54 |
-
},
|
| 55 |
-
}),
|
| 56 |
-
}
|
| 57 |
);
|
| 58 |
|
| 59 |
if (generated_text) {
|
|
|
|
| 43 |
model: PUBLIC_MODEL_ENDPOINT,
|
| 44 |
inputs: prompt,
|
| 45 |
parameters,
|
| 46 |
+
accessToken: HF_TOKEN,
|
| 47 |
},
|
| 48 |
+
{ fetch }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
);
|
| 50 |
|
| 51 |
if (generated_text) {
|