Git Product home page Git Product logo

plugin_sdwebui's Introduction

插件描述

本插件用于将画图请求转发给stable diffusion webui。

环境要求

使用前先安装stable diffusion webui,并在它的启动参数中添加 "--api"。

具体信息,请参考文章

部署运行后,保证主机能够成功访问http://127.0.0.1:7860/docs

安装本插件的依赖包webuiapi

pip install webuiapi

使用说明

请将config.json.template复制为config.json,并修改其中的参数和规则。

PS: 如果修改了webui的hostport,也需要在配置文件中更改启动参数, 更多启动参数参考:https://github.com/mix1009/sdwebuiapi/blob/a1cb4c6d2f39389d6e962f0e6436f4aa74cd752c/webuiapi/webuiapi.py#L114

画图请求格式

用户的画图请求格式为:

    <画图触发词><关键词1> <关键词2> ... <关键词n>:<prompt> 
  • 本插件会对画图触发词后的关键词进行逐个匹配,如果触发了规则中的关键词,则会在画图请求中重载对应的参数。
  • 规则的匹配顺序参考config.json中的顺序,每个关键词最多被匹配到1次,如果多个关键词触发了重复的参数,重复参数以最后一个关键词为准。
  • 关键词中包含help帮助,会打印出帮助文档。

第一个":"号之后的内容会作为附加的prompt,接在最终的prompt后

例如: 画横版 高清 二次元:cat

会触发三个关键词 "横版", "高清", "二次元",prompt为"cat"

若默认参数是:

    "width": 512,
    "height": 512,
    "enable_hr": false,
    "prompt": "8k"
    "negative_prompt": "nsfw",
    "sd_model_checkpoint": "perfectWorld_v2Baked"

"横版"触发的规则参数为:

    "width": 640,
    "height": 384,

"高清"触发的规则参数为:

    "enable_hr": true,
    "hr_scale": 1.6,

"二次元"触发的规则参数为:

    "negative_prompt": "(low quality, worst quality:1.4),(bad_prompt:0.8), (monochrome:1.1), (greyscale)",
    "steps": 20,
    "prompt": "masterpiece, best quality",

    "sd_model_checkpoint": "meinamix_meinaV8"

以上这些规则的参数会和默认参数合并。第一个":"后的内容cat会连接在prompt后。

得到最终参数为:

    "width": 640,
    "height": 384,
    "enable_hr": true,
    "hr_scale": 1.6,
    "negative_prompt": "(low quality, worst quality:1.4),(bad_prompt:0.8), (monochrome:1.1), (greyscale)",
    "steps": 20,
    "prompt": "masterpiece, best quality, cat",
    
    "sd_model_checkpoint": "meinamix_meinaV8"

PS: 实际参数分为两部分:

  • 一部分是params,为画画的参数;参数名必须与webuiapi包中txt2img api的参数名一致
  • 另一部分是options,指sdwebui的设置,使用的模型和vae需写在里面。它和(http://127.0.0.1:7860/sdapi/v1/options )所返回的键一致。

plugin_sdwebui's People

Contributors

lanvent 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.