feat: support upscaled image generation with esrgan (#509)

This commit is contained in:
Ettore Di Giacinto 2023-06-05 17:21:38 +02:00 committed by GitHub
parent ec4fd1d219
commit b447a2a719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -15,7 +15,7 @@ BLOOMZ_VERSION?=1834e77b83faafe912ad4092ccf7f77937349e2f
export BUILD_TYPE?= export BUILD_TYPE?=
CGO_LDFLAGS?= CGO_LDFLAGS?=
CUDA_LIBPATH?=/usr/local/cuda/lib64/ CUDA_LIBPATH?=/usr/local/cuda/lib64/
STABLEDIFFUSION_VERSION?=c0748eca3642d58bcf9521108bcee46959c647dc STABLEDIFFUSION_VERSION?=d89260f598afb809279bc72aa0107b4292587632
GO_TAGS?= GO_TAGS?=
BUILD_ID?=git BUILD_ID?=git
LD_FLAGS=?= LD_FLAGS=?=

2
go.mod
View File

@ -14,7 +14,7 @@ require (
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-multierror v1.1.1
github.com/imdario/mergo v0.3.16 github.com/imdario/mergo v0.3.16
github.com/mudler/go-stable-diffusion v0.0.0-20230516152536-c0748eca3642 github.com/mudler/go-stable-diffusion v0.0.0-20230605114250-a6706a426a90
github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20230604125924-bbe195ee0207 github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20230604125924-bbe195ee0207
github.com/onsi/ginkgo/v2 v2.9.7 github.com/onsi/ginkgo/v2 v2.9.7
github.com/onsi/gomega v1.27.7 github.com/onsi/gomega v1.27.7

View File

@ -8,6 +8,18 @@ import (
) )
func GenerateImage(height, width, mode, step, seed int, positive_prompt, negative_prompt, dst, asset_dir string) error { 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( return stableDiffusion.GenerateImage(
height, height,
width, width,