31 lines
896 B
TypeScript
31 lines
896 B
TypeScript
import { StableDiffusionApi } from "stable-diffusion-api";
|
|
|
|
export const sdClient = new StableDiffusionApi({
|
|
host: "127.0.0.1",
|
|
port: 7860,
|
|
protocol: "http",
|
|
defaultSampler: "DPM++ 2M Karras",
|
|
defaultStepCount: 22,
|
|
});
|
|
|
|
await sdClient.setModel("deliberate_v3");
|
|
|
|
export async function predict(prompt: string) {
|
|
const result = await sdClient.txt2img({
|
|
prompt: prompt,
|
|
negative_prompt: '[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry',
|
|
batch_size: 1,
|
|
cfg_scale: 7,
|
|
width: 640,
|
|
height: 640,
|
|
enable_hr: false,
|
|
hr_resize_x: 1280,
|
|
hr_resize_y: 1280,
|
|
hr_upscaler: "4x_NMKD-Siax_200k",
|
|
hr_second_pass_steps: 8,
|
|
denoising_strength: 0.36,
|
|
seed: -1
|
|
});
|
|
|
|
return result;
|
|
} |