feat: add some stuff
This commit is contained in:
@ -17,13 +17,13 @@
|
||||
let questionVisible = false;
|
||||
|
||||
onMount(() => {
|
||||
// curtainsVisible = true;
|
||||
curtainsVisible = false;
|
||||
maskVisible = true;
|
||||
maskSmall = true;
|
||||
questionVisible = true;
|
||||
curtainsVisible = true;
|
||||
// curtainsVisible = false;
|
||||
// maskVisible = true;
|
||||
// maskSmall = true;
|
||||
// questionVisible = true;
|
||||
setTimeout(() => {
|
||||
// buttonVisible = true;
|
||||
buttonVisible = true;
|
||||
}, 1500);
|
||||
});
|
||||
</script>
|
||||
|
25
src/routes/api/ai/frame/+server.ts
Normal file
25
src/routes/api/ai/frame/+server.ts
Normal file
@ -0,0 +1,25 @@
|
||||
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}`
|
||||
})
|
||||
}
|
@ -3,25 +3,38 @@ import type { RequestHandler } from "./$types";
|
||||
import { putObject } from "$lib/helpers/minio";
|
||||
import { generateImage } from "$lib/helpers/stability";
|
||||
|
||||
export const GET: RequestHandler = async ({ params }) => {
|
||||
export const POST: RequestHandler = async ({ params, request }) => {
|
||||
|
||||
const inputName = params.name;
|
||||
if (!inputName) {
|
||||
throw new Error("Missing name");
|
||||
}
|
||||
if (inputName.length > 50) {
|
||||
throw new Error("Name too long");
|
||||
}
|
||||
|
||||
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 { hairType, hairColor, hairLength } = await request.json();
|
||||
console.log(hairType, hairColor, hairLength)
|
||||
|
||||
if (!hairType || !hairColor || !hairLength) {
|
||||
throw new Error("Missing hairType, hairColor or hairLength");
|
||||
}
|
||||
|
||||
const prompt = `realistic portrait oil painting of a masked ${inputName}, baroque, in the style of Charles Vess, masked ball attire, opulence, mystery, elegance, ${hairLength} ${hairType} ${hairColor} hair, darker skin`;
|
||||
const negativePrompt = "blurry, multiple persons, picture frame"
|
||||
|
||||
const a = performance.now()
|
||||
// #const image = await openai.image(prompt);
|
||||
const image = await generateImage(prompt, negativePrompt);
|
||||
const duration = performance.now() - a;
|
||||
|
||||
console.log({ duration })
|
||||
|
||||
const imageName = `${image.seed}-${inputName.toLowerCase().split(" ").slice(0, 5).join("-").slice(0, 25)}.png`
|
||||
const imageName = `${Math.random().toString(16).substring(3, 10)}-${inputName.toLowerCase().split(" ").slice(0, 5).join("-").slice(0, 25)}.png`
|
||||
|
||||
const res = await putObject(imageName, Buffer.from(image.base64, 'base64'), { "Content-Type": "image/png" });
|
||||
await putObject(imageName, Buffer.from(image.base64, 'base64'), { "Content-Type": "image/png" });
|
||||
|
||||
return json({
|
||||
...res,
|
||||
url: `https://s3.app.max-richter.dev/silvester23/${imageName}`
|
||||
duration,
|
||||
url: `https://s3-api.app.max-richter.dev/silvester23/${imageName}`
|
||||
})
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { type RequestHandler } from "@sveltejs/kit";
|
||||
import { chat } from "$lib/helpers/chatgpt";
|
||||
import { json, type RequestHandler } from "@sveltejs/kit";
|
||||
import { chat } from "$lib/helpers/openai";
|
||||
|
||||
|
||||
export const GET: RequestHandler = async function ({ params }) {
|
||||
|
||||
const inputName = params.name
|
||||
|
||||
const prompt = `Generate 10 variants of the name ${inputName}. The names should sound very much like the original but also like noble names from the 1900 century. Examples could be "lady rosalind of whitmore" "lord byron of castlemore" "Lord Max Richter". 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 from the 1900 century. 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);
|
||||
const res = await chat(prompt, { isList: true, temperature: 1 });
|
||||
|
||||
return new Response(res);
|
||||
return json(res);
|
||||
}
|
||||
|
35
src/routes/api/invites/+server.ts
Normal file
35
src/routes/api/invites/+server.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import * as sheet from '$lib/helpers/sheets'
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import * as pb from "$lib/helpers/pb"
|
||||
export const GET: RequestHandler = async () => {
|
||||
|
||||
const res = await sheet.getData();
|
||||
|
||||
return json(res);
|
||||
|
||||
}
|
||||
|
||||
export const POST: RequestHandler = async ({ request }) => {
|
||||
|
||||
const body = await request.json();
|
||||
console.log(body)
|
||||
try {
|
||||
await sheet.addPerson({ name: body.name, confidence: body.confidence.toString(), noble_name: body.adelsTitel })
|
||||
|
||||
await pb.createPerson({
|
||||
name: body.name,
|
||||
confidence: body.confidence,
|
||||
noble_name: body.adelsTitel,
|
||||
portrait: body.portraitUrl,
|
||||
hair_length: body.portraitHairLength,
|
||||
hair_type: body.portraitHairType,
|
||||
hair_color: body.portraitHairColor,
|
||||
portrait_public: body.portraitPublic,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
return json(body);
|
||||
}
|
7
src/routes/image/+page.svelte
Normal file
7
src/routes/image/+page.svelte
Normal file
@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import ImageFrame from '$lib/components/ImageFrame.svelte';
|
||||
</script>
|
||||
|
||||
<ImageFrame
|
||||
src="https://s3-api.app.max-richter.dev/silvester23/13770f0-earl-maximus-of-richterla.png"
|
||||
/>
|
5
src/routes/questions/+page.svelte
Normal file
5
src/routes/questions/+page.svelte
Normal file
@ -0,0 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Questions from '$lib/components/Questions.svelte';
|
||||
</script>
|
||||
|
||||
<Questions />
|
Reference in New Issue
Block a user