Updated
This commit is contained in:
parent
c538b35342
commit
b154af3c73
|
@ -22,15 +22,15 @@ func getProdiaKey() string {
|
|||
return os.Getenv("PRODIA_KEY")
|
||||
}
|
||||
|
||||
func RequestGeneration() (*rtypes.ProdiaGenerateResponse, error) {
|
||||
func RequestGeneration(prompt string, negative string) (*rtypes.ProdiaGenerateResponse, error) {
|
||||
req := rtypes.ProdiaGenerateRequest{
|
||||
Model: rtypes.Deliberate_v2,
|
||||
Prompt: "beautiful woman wearing military clothing, woman, girl, beautiful, masterpiece, pretty, blue eyes, military, uniform, army",
|
||||
NegativePrompt: "man, ugly, destroyed, nsfw, nudity",
|
||||
Steps: 25,
|
||||
Prompt: prompt,
|
||||
NegativePrompt: negative,
|
||||
Steps: 35,
|
||||
CFGScale: 6.5,
|
||||
Seed: -1,
|
||||
Upscale: true,
|
||||
Upscale: false,
|
||||
Sampler: rtypes.DPMpp2MK,
|
||||
AspectRatio: rtypes.Square,
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ func FetchGeneration(jobId string) (*rtypes.ProdiaRetrieveResponseX, error) {
|
|||
return nil, errors.New("API Error")
|
||||
}
|
||||
|
||||
fmt.Println("Not done yet, waiting... ::" + responseJson.Status)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
|
|
|
@ -42,13 +42,13 @@ const (
|
|||
|
||||
type ProdiaGenerateRequest struct {
|
||||
Model ProdiaModel `json:"model"`
|
||||
Prompt ProdiaSampler `json:"prompt"`
|
||||
Prompt string `json:"prompt"`
|
||||
NegativePrompt string `json:"negative_prompt"`
|
||||
Steps int `json:"steps"`
|
||||
CFGScale float32 `json:"cfg_scale"`
|
||||
Seed int64 `json:"seed"`
|
||||
Upscale bool `json:"upscale"`
|
||||
Sampler string `json:"sampler"`
|
||||
Sampler ProdiaSampler `json:"sampler"`
|
||||
AspectRatio ProdiaAspectRatio `json:"aspect_ratio"`
|
||||
}
|
||||
|
||||
|
|
16
main.go
16
main.go
|
@ -12,6 +12,10 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
const (
|
||||
NEGATIVE_PROMPT = "(nsfw:1.1), (porn:1.1), (naked:1.1), (nude:1.1), (nipple:1.1), (penis:1.1), (dick:1.1), (vagina:1.1), (asshole:1.1), visible nipple, nsfl, not safe for work, nudity, artifact, deformed, multiple limbs, ugly, gore, blood, sex, pornography, penis, dick, genitalia, male genitalia, anus, penetration, double penetration, cock"
|
||||
)
|
||||
|
||||
var nodes [1]rtypes.SDNode = [...]rtypes.SDNode{
|
||||
rtypes.SDNode{
|
||||
URL: "127.0.0.1",
|
||||
|
@ -75,7 +79,15 @@ func main() {
|
|||
}
|
||||
|
||||
func generateProdiaImage(c *gin.Context) {
|
||||
resp, err := prodia.RequestGeneration()
|
||||
|
||||
imageDescriptior := c.PostForm("image_description")
|
||||
|
||||
if goaway.IsProfane(imageDescriptior) {
|
||||
imageDescriptior = goaway.Censor(imageDescriptior)
|
||||
fmt.Printf("Found profanity, censoring to: %s\n", imageDescriptior)
|
||||
}
|
||||
|
||||
resp, err := prodia.RequestGeneration(imageDescriptior, NEGATIVE_PROMPT)
|
||||
if err != nil {
|
||||
c.AbortWithError(500, err)
|
||||
return
|
||||
|
@ -110,7 +122,7 @@ func generateSDImage(c *gin.Context) {
|
|||
CfgScale: 8,
|
||||
Width: 512,
|
||||
Height: 512,
|
||||
NegativePrompt: "(nsfw:1.1), (porn:1.1), (naked:1.1), (nude:1.1), (nipple:1.1), (penis:1.1), (dick:1.1), (vagina:1.1), (asshole:1.1), visible nipple, nsfl, not safe for work, nudity, artifact, deformed, multiple limbs, ugly, gore, blood, sex, pornography, penis, dick, genitalia, male genitalia, anus, penetration, double penetration, cock",
|
||||
NegativePrompt: NEGATIVE_PROMPT,
|
||||
SamplerIndex: "Euler",
|
||||
SendImages: true,
|
||||
SaveImages: false,
|
||||
|
|
Reference in New Issue