AndBobsYourUncle / stable-diffusion-discord-bot

A Discord bot, written in Go, that interfaces with the Automatic 1111's API interface.
MIT License
128 stars 35 forks source link

negative prompt #11

Open AmajesticBob opened 1 year ago

AmajesticBob commented 1 year ago

is there a way to add negative prompt

hobolyra commented 1 year ago

Not currently it seems. would love to see this added!

DavidSchobl commented 1 year ago

I would love the negative prompt too. Something like: --np {prompt}

bitburner commented 1 year ago

You can change the negative prompt in the source imagine_queue/queue.go at line 348 and recompile the binary with your new negative defaults. This is what it is now:

NegativePrompt: "ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, " + "mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, " + "body out of frame, blurry, bad art, bad anatomy, blurred, text, watermark, grainy",

It's not ideal but at least for now you can add or change the "defaults". Be aware this will alter any past upscale in the database from the point you alter the negatives as I don't think they are stored in the database (I could be wrong on that). But just a heads up.

DavidSchobl commented 1 year ago

I found that part, but I am thinking about reprogramming it, but that would mean learning another coding language for me. :D I wonder if @AmajesticBob plans any updates of this amazing peace of work!!! ? <3

shihanqu commented 11 months ago

Bump on this request! Would be cool to put negative prompts in [square brackets] or something @AndBobsYourUncle

shihanqu commented 11 months ago

Here's a function to put in queue.go that can separate content in the outer [square brackets] as the negative prompt:

import (
    "fmt"
    "regexp"
)

func parsePrompts(input string) (string, string) {
    re := regexp.MustCompile(`\[(.*?)\]`)
    matches := re.FindAllStringSubmatch(input, -1)

    positivePrompt := input
    negativePrompt := ""

    if len(matches) > 0 {
        negativePrompt = matches[0][1]
        positivePrompt = re.ReplaceAllString(input, "")
    }

    return positivePrompt, negativePrompt
}