Spaces:
Running
Running
use secret instead of public
Browse files
src/routes/api/image-generation/+server.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import { error, type RequestEvent } from '@sveltejs/kit';
|
| 2 |
-
import { SECRET_HF_TOKEN } from '$env/static/private'
|
| 3 |
-
import { PUBLIC_INFERENCE_API_URL } from '$env/static/public'
|
| 4 |
|
| 5 |
/** @type {import('./$types').RequestHandler} */
|
| 6 |
export async function POST({ request }: RequestEvent) {
|
|
@@ -14,7 +13,7 @@ export async function POST({ request }: RequestEvent) {
|
|
| 14 |
throw error(400, 'missing inputs value')
|
| 15 |
}
|
| 16 |
|
| 17 |
-
const response = await fetch(
|
| 18 |
method: "POST",
|
| 19 |
headers: {
|
| 20 |
Authorization: `Bearer ${SECRET_HF_TOKEN}`,
|
|
|
|
| 1 |
import { error, type RequestEvent } from '@sveltejs/kit';
|
| 2 |
+
import { SECRET_HF_TOKEN, SECRET_INFERENCE_API_URL } from '$env/static/private'
|
|
|
|
| 3 |
|
| 4 |
/** @type {import('./$types').RequestHandler} */
|
| 5 |
export async function POST({ request }: RequestEvent) {
|
|
|
|
| 13 |
throw error(400, 'missing inputs value')
|
| 14 |
}
|
| 15 |
|
| 16 |
+
const response = await fetch(SECRET_INFERENCE_API_URL + "/models/" + body.model, {
|
| 17 |
method: "POST",
|
| 18 |
headers: {
|
| 19 |
Authorization: `Bearer ${SECRET_HF_TOKEN}`,
|
src/routes/api/text-generation/+server.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import { error, json, type RequestEvent } from '@sveltejs/kit';
|
| 2 |
-
import { SECRET_HF_TOKEN } from '$env/static/private'
|
| 3 |
-
import { PUBLIC_INFERENCE_API_URL } from '$env/static/public'
|
| 4 |
|
| 5 |
/** @type {import('./$types').RequestHandler} */
|
| 6 |
export async function POST({ request }: RequestEvent) {
|
|
@@ -14,7 +13,7 @@ export async function POST({ request }: RequestEvent) {
|
|
| 14 |
throw error(400, 'missing inputs value')
|
| 15 |
}
|
| 16 |
|
| 17 |
-
const response = await fetch(
|
| 18 |
method: "POST",
|
| 19 |
headers: {
|
| 20 |
Authorization: `Bearer ${SECRET_HF_TOKEN}`,
|
|
|
|
| 1 |
import { error, json, type RequestEvent } from '@sveltejs/kit';
|
| 2 |
+
import { SECRET_HF_TOKEN, SECRET_INFERENCE_API_URL } from '$env/static/private'
|
|
|
|
| 3 |
|
| 4 |
/** @type {import('./$types').RequestHandler} */
|
| 5 |
export async function POST({ request }: RequestEvent) {
|
|
|
|
| 13 |
throw error(400, 'missing inputs value')
|
| 14 |
}
|
| 15 |
|
| 16 |
+
const response = await fetch(SECRET_INFERENCE_API_URL + "/models/" + body.model, {
|
| 17 |
method: "POST",
|
| 18 |
headers: {
|
| 19 |
Authorization: `Bearer ${SECRET_HF_TOKEN}`,
|