fix: some stuff
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import Minio from 'minio'
|
||||
import { Client, type ItemBucketMetadata } from 'minio'
|
||||
|
||||
import { S3_ENDPOINT_URL, S3_SECRET_ACCESS_KEY, S3_BUCKET_NAME, S3_ACCESS_KEY } from "$env/static/private"
|
||||
|
||||
const minioClient = new Minio.Client({
|
||||
const minioClient = new Client({
|
||||
endPoint: S3_ENDPOINT_URL,
|
||||
port: 80,
|
||||
useSSL: false,
|
||||
@ -10,7 +10,7 @@ const minioClient = new Minio.Client({
|
||||
secretKey: S3_SECRET_ACCESS_KEY,
|
||||
})
|
||||
|
||||
export function putObject(fileName: string, content: Buffer, metadata: Minio.ItemBucketMetadata = {}) {
|
||||
export function putObject(fileName: string, content: Buffer, metadata: ItemBucketMetadata = {}) {
|
||||
return minioClient.putObject(S3_BUCKET_NAME, fileName, content, metadata);
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { json } from "@sveltejs/kit";
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { putObject } from "$lib/helpers/s3";
|
||||
import { putObject } from "$lib/helpers/minio";
|
||||
import { generateImage } from "$lib/helpers/stability";
|
||||
|
||||
|
||||
export const GET: RequestHandler = async ({ params }) => {
|
||||
|
||||
const inputName = params.name;
|
||||
|
||||
const prompt = `realistic profile portrait oil painting of a masked ${inputName}, baroque, Charles Vess, masked ball attire, Charles Vess, opulence, mystery, elegance, medium-length blond hair, darker skin`;
|
||||
const negativePrompt = "blurry, multiple persons, picture frame"
|
||||
|
||||
const a = performance.now()
|
||||
const image = await generateImage(prompt, negativePrompt);
|
||||
const duration = performance.now() - a;
|
||||
|
@ -1,25 +0,0 @@
|
||||
import { json } from "@sveltejs/kit";
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { putObject } from "$lib/helpers/s3";
|
||||
|
||||
|
||||
|
||||
export const GET: RequestHandler = async ({ params }) => {
|
||||
|
||||
const inputName = params.name;
|
||||
|
||||
const prompt = `upper body realistic portrait oil painting of a masked ${inputName}, Baroque, Charles Vess, masked ball attire, Charles Vess, opulence, mystery, elegance, dark long hair`;
|
||||
const negativePrompt = "blurry, multiple persons, picture frame";
|
||||
|
||||
const image = generateImage(prompt, negativePrompt);
|
||||
|
||||
const imageName = `txt2img_${image.seed}.png`;
|
||||
|
||||
const res = await putObject(imageName, Buffer.from(image.base64, 'base64'), { contentType: "image/png" });
|
||||
|
||||
return json({
|
||||
...res,
|
||||
url: `https://s3.app.max-richter.dev/silvester23/${imageName}`
|
||||
});
|
||||
};
|
||||
|
@ -1,8 +0,0 @@
|
||||
import { getBuckets } from "$lib/helpers/s3";
|
||||
import { json } from "@sveltejs/kit";
|
||||
import type { RequestHandler } from "./$types";
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
const buckets = await getBuckets()
|
||||
return json(buckets)
|
||||
}
|
Reference in New Issue
Block a user