File size: 545 Bytes
3ebd805
c8d90f4
 
1b66f8d
3ddb8c6
c8d90f4
3ddb8c6
3ebd805
c8d90f4
 
 
 
3ddb8c6
 
 
 
 
 
c8d90f4
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
	});
}