feat: log some more stuff

This commit is contained in:
max_richter 2023-11-13 16:23:52 +01:00
parent 35a3b1f8f3
commit 21d4aaf5e0
4 changed files with 6 additions and 28 deletions

View File

@ -64,7 +64,8 @@
hairType: $data.portraitHairType, hairType: $data.portraitHairType,
hairColor: $data.portraitHairColor, hairColor: $data.portraitHairColor,
hairLength: $data.portraitHairLength, hairLength: $data.portraitHairLength,
skinColor: $data.portraitSkinColor skinColor: $data.portraitSkinColor,
name: $data.name
}) })
}); });

View File

@ -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}`
})
}

View File

@ -49,9 +49,9 @@ export const POST: RequestHandler = async ({ params, request }) => {
throw new Error("Name too long"); throw new Error("Name too long");
} }
const { hairType, hairColor, hairLength, skinColor } = await request.json(); const { hairType, hairColor, hairLength, skinColor, name } = await request.json();
console.log(`[AI] Generating image for ${inputName} ${JSON.stringify({ hairType, hairColor, hairLength, skinColor })}`)
console.log(`[AI] Generating image for ${inputName} ${JSON.stringify({ hairType, hairColor, hairLength, skinColor, name })}`)
if (!hairType || !hairColor || !hairLength) { if (!hairType || !hairColor || !hairLength) {
throw new Error("Missing hairType, hairColor or hairLength"); throw new Error("Missing hairType, hairColor or hairLength");
} }

View File

@ -6,9 +6,11 @@ export const GET: RequestHandler = async function ({ params }) {
const inputName = params.name 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 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 }); const res = await chat(prompt, { isList: true, temperature: 1 });
console.log(`[AI] Generated names for ${inputName} in ${performance.now() - a}ms`);
return json(res); return json(res);
} }