Spaces:
Running
Running
File size: 545 Bytes
a23680a 4ef1838 8aab1a5 ec88cc7 4ef1838 ec88cc7 a23680a 4ef1838 ec88cc7 4ef1838 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import { HF_TOKEN } from '$env/static/private';
import { PUBLIC_MODEL_ENDPOINT } from '$env/static/public';
export async function POST({ request, fetch }) {
const resp = await fetch(PUBLIC_MODEL_ENDPOINT, {
headers: {
'Content-Type': request.headers.get('Content-Type') ?? 'application/json',
Authorization: `Basic ${HF_TOKEN}`
},
method: 'POST',
body: await request.text()
});
return new Response(resp.body, {
headers: Object.fromEntries(resp.headers.entries()),
status: resp.status,
statusText: resp.statusText
});
}
|