GithubHelp home page GithubHelp logo

skunkworxdark / generative-grammar-prompt-nodes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dwringer/generative-grammar-prompt-nodes

1.0 0.0 0.0 110 KB

Generative Grammar-Based Prompt nodes for InvokeAI

License: MIT License

Python 100.00%

generative-grammar-prompt-nodes's Introduction

lookups usage example graph

Installation:

To install these nodes, simply place the folder containing this repository's code (or just clone the repository yourself) into your invokeai/nodes folder.

Generative Grammar-Based Prompt Nodes

This generates prompts from simple user-defined grammar rules (loaded from custom files - examples provided below). The prompts are made by recursively expanding a special template string, replacing nonterminal "parts-of-speech" until no more nonterminal terms remain in the string.

As a basic example, the template {picture} of {subject} might be expanded to {photoQuality} photo of {person}, which might subsequently expand to professional photo of Barack Obama (assuming these definitions were present in the lookup table):

prompt:
  templates:
    - "{picture} of {subject}"
  picture:
    - sketch
    - cartoon
    - "{photoQuality} photo"
  photoQuality:
    - professional
    - amateur
  subject:
    - "{person}"
  person:
    - Barack Obama
    - George Bush
    - Tom Hanks
    - Rami Malek

Three nodes are included:

  • Lookup Table from File - loads a YAML file "prompt" section (or of a whole folder of YAML's) into a JSON-ified dictionary (Lookups output)
  • Lookups Entry from Prompt - places a single entry in a new Lookups output under the specified heading
  • Prompt from Lookup Table - uses a Collection of Lookups as grammar rules from which to randomly generate prompts.

There are some example .yaml files here to give some ideas about what sort of things are possible. Most of these possibilities are illustrated by the file example_template.yaml.

generative-grammar-prompt-nodes's People

Contributors

dwringer avatar skunkworxdark avatar

Stargazers

Ade avatar

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.