From 4992174f21acf39b71531f8edff97691fe6919fe Mon Sep 17 00:00:00 2001 From: Daniel Legt Date: Thu, 4 May 2023 16:51:05 +0300 Subject: [PATCH] + Model Select --- lib/prodia/prodia.go | 2 +- main.go | 3 ++- public/css/buttons.css | 18 ++++++++++++++++++ templates/home/index.html | 23 +++++++++++++++++++++-- 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lib/prodia/prodia.go b/lib/prodia/prodia.go index 757beae..07d98bc 100644 --- a/lib/prodia/prodia.go +++ b/lib/prodia/prodia.go @@ -22,7 +22,7 @@ func getProdiaKey() string { return os.Getenv("PRODIA_KEY") } -func RequestGeneration(prompt string, negative string) (*rtypes.ProdiaGenerateResponse, error) { +func RequestGeneration(prompt string, negative string, modelChoice rtypes.ProdiaModel) (*rtypes.ProdiaGenerateResponse, error) { req := rtypes.ProdiaGenerateRequest{ Model: rtypes.Deliberate_v2, Prompt: prompt, diff --git a/main.go b/main.go index 98a62e4..733ee32 100644 --- a/main.go +++ b/main.go @@ -82,13 +82,14 @@ func generateProdiaImage(c *gin.Context) { imageDescriptior := c.PostForm("image_description") negativePrompt := c.PostForm("negative_prompt") + modelChoice := c.PostForm("model_choice") if goaway.IsProfane(imageDescriptior) { imageDescriptior = goaway.Censor(imageDescriptior) fmt.Printf("Found profanity, censoring to: %s\n", imageDescriptior) } - resp, err := prodia.RequestGeneration(imageDescriptior, fmt.Sprintf("%s,%s", negativePrompt, NEGATIVE_PROMPT)) + resp, err := prodia.RequestGeneration(imageDescriptior, fmt.Sprintf("%s,%s", negativePrompt, NEGATIVE_PROMPT), rtypes.ProdiaModel(modelChoice)) if err != nil { c.AbortWithError(500, err) return diff --git a/public/css/buttons.css b/public/css/buttons.css index b0a9fdf..0f8a5f6 100644 --- a/public/css/buttons.css +++ b/public/css/buttons.css @@ -43,4 +43,22 @@ textarea:hover { textarea:focus { background-color: #e8e8e8; +} + +select { + background-color: #c0c0c0; + color: black; + border: 2px outset gray; + font-size: 16px; + font-family: "Arial", sans-serif; + padding: 6px 12px; + resize: vertical; +} + +select:hover { + background-color: #d8d8d8; +} + +select:focus { + background-color: #e8e8e8; } \ No newline at end of file diff --git a/templates/home/index.html b/templates/home/index.html index 0dba0e4..0449619 100644 --- a/templates/home/index.html +++ b/templates/home/index.html @@ -64,9 +64,28 @@
Prompt - Negative Prompt - + +