GithubHelp home page GithubHelp logo

inkbunny-app's Introduction


Inkbunny Auditor

Inkbunny API api reference api github Go Report Card
Inkbunny ML contributors Commit Activity GitHub Repo stars


Disclaimer: This project is not affiliated or endorsed by Inkbunny.

Go Gopher climbing a ladder.

This project is designed to detect AI-generated images made with stable diffusion in Inkbunny submissions. It processes the descriptions of submissions and extracts prompt details through a Language Learning Model (LLM). The processed data is then structured into a text-to-image format.

By using crafted heuristics, as well as the potential to use an LLM to inference the parameters. A general purpose API library is available to integrate with your own program logic.

There are three different projects that aim to help in auditing and moderating AI generated content.

Inkbunny ML: A General-Purpose API

Inkbunny ML offers a comprehensive suite of tools designed for auditing and moderating AI-generated content. It includes an extensive database that manages everything from tickets and auditors to artist lookups and the auditing process itself.

To boost performance, this module integrates a dual-layer caching system, utilizing both local and Redis caches. This strategy is crafted to deliver aggressive performance improvements and scalable results.

Inkbunny ML

It can also pre-write a ticket The system simplifies your workflow by automatically generating a prepared ticket based on smart heuristics. This allows you to focus on the essential tasks of auditing and modifying the ticket before submission to Inkbunny.

Inkbunny ML

The Inkbunny AI Bridge extends the functionality of your browser through a userscript that creates a ticket ready for your review. Based on advanced heuristics, the script prepares everything you need to ensure the content meets Inkbunny's standards.

It displays a badge on each submission to quickly notify you of any potential flagged submission worth verifying.

Inkbunny AI Bridge

It constructs a prepared ticket based on the heuristics for you to audit and modify to then submit to Inkbunny.

Inkbunny AI Bridge

CLI: Command Line Interface

For those who prefer the directness of a command line, the CLI offers a robust interface for engaging with the Inkbunny ML API. It's an effective alternative to the web interface, providing all the necessary commands at your fingertips.

Inkbunny CLI

Usage

Make sure you have api turned on in your Inkbunny account settings. You will need your API key and SID to use the Inkbunny API. You can change this in your account settings

You can read the individual readme files for each project to get started. An example usage for Inkbunny AI Bridge is provided below.

Set the environment variables for the server to run. You can set the following environment variables:

export PORT "your_port" # default is 1323
export API_HOST "your_api_host"
export SD_HOST "your_sd_host" # default is "http://localhost:7860"
export REDIS_HOST "your_redis_host" # default is "localhost:6379", when not set, uses local memory cache
export REDIS_PASSWORD "your_redis_password"
export REDIS_USER "your_redis_user" # when not set, uses 'default'

An optional Redis server can be used for caching. If not set, it will fall back to local memory cache. You can always override this behavior for most request by setting the Cache-Control header to no-cache.

Building from Source

If you're building from source, you will need to install the dependencies: Download Go 1.22.3 or later from the official website.

When cloning from the repository, make sure to use --recurse-submodules to initialize inkbunny-sd.

git clone --recurse-submodules https://github.com/ellypaws/inkbunny-app.git
cd inkbunny-app/cmd/extension

go build -o inkbunny-ai-bridge
./inkbunny-ai-bridge

And when pulling, make sure to update the submodules:

git pull --recurse-submodules

# or if you forgot to clone with submodules
git pull
git submodule update --init --recursive

You can also use the pre-built binaries from the releases page.

inkbunny-app's People

Contributors

ellypaws avatar

Stargazers

Hoya Kim avatar

Watchers

 avatar

inkbunny-app's Issues

Parse parameters in txt files and Description

Prerequesite

We need to create a feature that intelligently parses parameters from text files associated with submissions. These files may contain information pertinent to the Stable Diffusion model such as prompts, negative prompts, steps, and the model itself. Additionally, we must handle cases where the submission text files are in JSON format, likely originating from ComfyUI, and pass this data without modification.

Occasionally, users may include parameters for multiple images within a single text file or embed them directly into the submission description. The task is to aggregate these prompts into a structured array of standard txt2img or img2img JSON objects. We also encounter user-generated scripts that output parameters in a tab/space-delimited format.

As a forward-looking goal, we aim to develop a solution using a Large Language Model (LLM) that can process the varied formats users employ to input prompts—whether in the submission description or text files—and consistently produce a valid, standardized JSON object.

Checklist:

  • Develop a parser that can interpret and extract Stable Diffusion parameters from .txt files.
  • Ensure the parser can handle and pass along JSON formatted text files, typically from ComfyUI, without alteration.
  • Implement logic to consolidate multiple image prompts from a single file into a standardized JSON array.
  • Recognize and convert tab/space-delimited parameter data into the desired JSON format.
  • Initiate a research and development task to design an LLM that can standardize various user input methods into a consistent JSON structure.
  • Rudimentary heuristics prompt and parameter extractor using RegEx and the key value extraction method included in https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/modules/infotext_utils.py#L233

Multiple text parser implemented with Common strategy implemented in 311aa6f#L152-L213

func Common(opts ...func(*Config)) (Params, error) {
        var c Config
        for _, f := range opts {
                f(&c)
        }
        if c.KeyCondition == nil {
                return nil, errors.New("condition for key is not set")
        }
        var chunks Params = make(Params)
        scanner := bufio.NewScanner(strings.NewReader(c.Text))


        var key string
        var foundNegative bool
        var extra string
        for scanner.Scan() {
                line := scanner.Text()
                if c.SkipCondition != nil && c.SkipCondition(line) {
                        continue
                }
                if foundNegative {
                        chunks[key][Parameters] += "\n" + line
                        foundNegative = false
                        key = ""
                        continue
                }
                if c.KeyCondition(line) {
                        key = c.Filename + line
                        chunks[key] = make(PNGChunk)
                        continue
                }
                if len(key) == 0 {
                        continue
                }
                if len(line) == 0 {
                        continue
                }
                if strings.HasPrefix(line, "Negative Prompt:") {
                        foundNegative = true
                        chunks[key][Parameters] += "\n" + line
                        continue
                }
                if len(extra) > 0 {
                        chunks[key][extra] += line
                        extra = ""
                        continue
                }
                switch line {
                case Postprocessing:
                        extra = Postprocessing
                        continue
                case Extras:
                        extra = Extras
                        continue
                }
                if len(chunks[key][Parameters]) > 0 {
                        chunks[key][Parameters] += "\n"
                }
                chunks[key][Parameters] += line
        }


        return chunks, nil
}

Acceptance Criteria:

  • The parser must accurately extract all relevant parameters from both plain text and JSON formatted files.
  • It should be capable of handling multiple prompt scenarios and output an organized JSON array.
  • The solution must be robust enough to interpret common user-generated formats, including tab/space-delimited entries.
  • The LLM should be able to varied and non-standard prompt and parameter of submissions, including multiple prompt/generation submissions.

Notes:

  • This feature is critical for enhancing our content management system and improving the moderation process.
  • The development team should consider scalability and maintainability when designing the parser, as user input methods may evolve over time.
  • It is recommended to involve community feedback in the testing phase to ensure the parser meets the needs of a diverse user base.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.