KI-Kunst-Kirsten-Kloeckner/KIKunstKirstenKlöckner/wwwroot/scripts/ImageMaster3000.js

32 lines
1007 B
JavaScript

import { HfInference } from 'https://cdn.jsdelivr.net/npm/@huggingface/inference@2.6.1/+esm';
import { createRepo, commit, deleteRepo, listFiles } from "https://cdn.jsdelivr.net/npm/@huggingface/hub@0.8.4/+esm";
async function DoSexyStuff(prompt)
{
const HF_ACCESS_TOKEN = "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";
const inference = new HfInference(HF_ACCESS_TOKEN);
const blob = await inference.textToImage({
//model: 'stabilityai/stable-diffusion-2',
model: 'Nacken/ki-kunst-kirsten-kloeckner-colab',
//inputs: 'award winning high resolution photo of a giant tortoise/((ladybird)) hybrid, [trending on artstation]',
inputs: prompt,
parameters: {
negative_prompt: 'blurry',
}
})
const imageUrl = window.URL.createObjectURL(blob);
return imageUrl;
//window.open(imageUrl, '_blank');
}
// Exportiere die Funktion in den globalen Kontext
window.DoSexyStuff = DoSexyStuff;
function showAlert(message) {
alert(message);
}