feat: log some more stuff
This commit is contained in:
parent
35a3b1f8f3
commit
21d4aaf5e0
@ -64,7 +64,8 @@
|
||||
hairType: $data.portraitHairType,
|
||||
hairColor: $data.portraitHairColor,
|
||||
hairLength: $data.portraitHairLength,
|
||||
skinColor: $data.portraitSkinColor
|
||||
skinColor: $data.portraitSkinColor,
|
||||
name: $data.name
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
import { json } from "@sveltejs/kit";
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { putObject } from "$lib/helpers/minio";
|
||||
import { generateImage } from "$lib/helpers/stability";
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
|
||||
const prompt = `golden brown rectangular picture frame, filled with pure red color, Charles Vess, opulence, mystery, elegance`;
|
||||
const negativePrompt = "blurry, persons, figure"
|
||||
|
||||
const a = performance.now()
|
||||
const image = await generateImage(prompt, negativePrompt);
|
||||
const duration = performance.now() - a;
|
||||
|
||||
console.log({ duration })
|
||||
|
||||
const imageName = `${image.seed}-frame.png`
|
||||
|
||||
const res = await putObject(imageName, Buffer.from(image.base64, 'base64'), { "Content-Type": "image/png" });
|
||||
|
||||
return json({
|
||||
...res,
|
||||
url: `https://s3.app.max-richter.dev/silvester23/${imageName}`
|
||||
})
|
||||
}
|
@ -49,9 +49,9 @@ export const POST: RequestHandler = async ({ params, request }) => {
|
||||
throw new Error("Name too long");
|
||||
}
|
||||
|
||||
const { hairType, hairColor, hairLength, skinColor } = await request.json();
|
||||
console.log(`[AI] Generating image for ${inputName} ${JSON.stringify({ hairType, hairColor, hairLength, skinColor })}`)
|
||||
const { hairType, hairColor, hairLength, skinColor, name } = await request.json();
|
||||
|
||||
console.log(`[AI] Generating image for ${inputName} ${JSON.stringify({ hairType, hairColor, hairLength, skinColor, name })}`)
|
||||
if (!hairType || !hairColor || !hairLength) {
|
||||
throw new Error("Missing hairType, hairColor or hairLength");
|
||||
}
|
||||
|
@ -6,9 +6,11 @@ export const GET: RequestHandler = async function ({ params }) {
|
||||
|
||||
const inputName = params.name
|
||||
|
||||
const a = performance.now();
|
||||
const prompt = `Generate 10 variants of the name ${inputName}. The names should sound very much like the original but also like noble names. Examples could be "lady rosalind of whitmore" "lord byron of castlemore" "Lord Max Richter". Choose english, german, french and italian sounding names. Only respond with 10 names seperated be newlines`;
|
||||
|
||||
const res = await chat(prompt, { isList: true, temperature: 1 });
|
||||
console.log(`[AI] Generated names for ${inputName} in ${performance.now() - a}ms`);
|
||||
|
||||
return json(res);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user