LocalAI/pkg/stablediffusion/generate.go
mudler 4d83ec5b02 feat: support upscaled image generation with esrgan
This allows to generate images larger than 512x512 by using esrgan.
Behind the scenes consumes
https://github.com/fengwang/Stable-Diffusion-NCNN/.

Note this needs model assets similar to those you can find
https://github.com/fengwang/Stable-Diffusion-NCNN/.
2023-06-05 14:25:45 +02:00

35 lines
610 B
Go

//go:build stablediffusion
// +build stablediffusion
package stablediffusion
import (
stableDiffusion "github.com/mudler/go-stable-diffusion"
)
func GenerateImage(height, width, mode, step, seed int, positive_prompt, negative_prompt, dst, asset_dir string) error {
if height > 512 || width > 512 {
return stableDiffusion.GenerateImageUpscaled(
height,
width,
step,
seed,
positive_prompt,
negative_prompt,
dst,
asset_dir,
)
}
return stableDiffusion.GenerateImage(
height,
width,
mode,
step,
seed,
positive_prompt,
negative_prompt,
dst,
"",
asset_dir,
)
}