+ Model Select

This commit is contained in:
Daniel Legt 2023-05-04 16:51:05 +03:00
parent fee62d1918
commit 4992174f21
4 changed files with 42 additions and 4 deletions

View File

@ -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,

View File

@ -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

View File

@ -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;
}

View File

@ -64,9 +64,28 @@
<div style="display: flex; flex-flow: column; padding: 0; margin: 0; margin-top: .5rem">
<span>Prompt</span>
<textarea name="image_description" id="image_description" rows="10" class="t95" placeholder="Prompt" style="margin-bottom: .5rem"></textarea>
<span>Negative Prompt</span>
<textarea name="negative_prompt" id="negative_prompt" rows="10" class="t95" placeholder="Negative Prompts">worst quality, corrupt, artifact, bad artist, noise, out of frame, duplicate, watermark, signature, text, morbid, blurry, bad proportions, disfigured</textarea>
<textarea name="negative_prompt" style="margin-bottom: .5rem" id="negative_prompt" rows="10" class="t95" placeholder="Negative Prompts">worst quality, corrupt, artifact, bad artist, noise, out of frame, duplicate, watermark, signature, text, morbid, blurry, bad proportions, disfigured</textarea>
<select name="model_choice" id="model_choice">
<option value="deliberate_v2.safetensors [10ec4b29]" selected >Deliberate_v2</option>
<option value="sdv1_4.ckpt [7460a6fa]" >SDV1_4</option>
<option value="v1-5-pruned-emaonly.ckpt [81761151]" >Pruned15</option>
<option value="anythingv3_0-pruned.ckpt [2700c435]" >Anythingv3_0</option>
<option value="anything-v4.5-pruned.ckpt [65745d25]" >Anything</option>
<option value="analog-diffusion-1.0.ckpt [9ca13f02]" >Analog</option>
<option value="theallys-mix-ii-churned.safetensors [5d9225a4]" >Theallys</option>
<option value="elldreths-vivid-mix.safetensors [342d9d26]" >Elldreths</option>
<option value="openjourney_V4.ckpt [ca2f377f]" >Openjourney_V4</option>
<option value="dreamlike-diffusion-1.0.safetensors [5c9fd6e0]" >Dreamlike1</option>
<option value="dreamlike-diffusion-2.0.safetensors [fdcf65e7]" >Dreamlike2</option>
<option value="portrait+1.0.safetensors [1400e684]" >Portrait1</option>
<option value="riffusion-model-v1.ckpt [3aafa6fe]" >Riffusion</option>
<option value="timeless-1.0.ckpt [7c4971d4]" >Timeless</option>
<option value="dreamshaper_5BakedVae.safetensors [a3fbf318]" >Dreamshaper_5BakedVae</option>
<option value="revAnimated_v122.safetensors [3f4fefd9]" >RevAnimated_v122</option>
<option value="meinamix_meinaV9.safetensors [2ec66ab0]" >Meinamix_meinaV9</option>
<option value="lyriel_v15.safetensors [65d547c5]" >Lyriel_v15</option>
</select>
<div style="display: flex; flex-flow: row; align-items: center; justify-content: center; margin: .5rem 0">
<button class="btn-95" style="width: calc(50% - .25rem); margin-right: .25rem">Generate Image</button>
<button class="btn-95" style="width: calc(50% - .25rem); margin-left: .25rem" id="random-prompt-button">Random Prompt</button>