- 支持运用百度AI进行图像处理
- 支持运用stable diffusion webui进行图像处理
- 支持运用stable diffusion webui画图
- 支持多种sd模型
- 支持并发控制
- 支持管理员修改Host
- 支持自定义模板
- 支持管理员开关群聊的图生图
- 支持管理员开关图生图功能,不影响文生图
- 支持企业微信,个人号,公众号部署
使用前先安装stable diffusion webui,并在它的启动参数中添加 "--api"。
安装具体信息,请参考视频。
部署运行后,保证主机能够成功访问http://127.0.0.1:7860/
如果是服务器部署则不必需要内网穿透,如果是本地电脑部署推荐cpolar启动内网穿透
请确保安装本插件的依赖包pip3 install -r requirements.txt
pip3 install -r requirements.txt
请将config.json.template
复制为config.json
,并修改其中的参数和规则。
PS: 修改了pictureChange的host
和port
和sd_model_checkpoint
和 api_key
,secret_key
,并填充相应的模型名称
- 群聊
- 单聊 直接发照片即可
用户的画图请求格式为:
<画图触发词><关键词1> <关键词2> ... <关键词n>:<prompt>
例如: 画高清 现实:男孩,强壮,挺拔,running,黑色耳机,白色短袖(中间有个羊字),黑色头发,黑色短裤
会触发三个关键词 "高清", "现实",
PS: 实际参数分为两部分:
- 一部分是
params
,为画画的参数;参数名必须与webuiapi包中txt2img api的参数名一致 - 另一部分是
sd_model_checkpoint
,它必须和你下载的模型(http://127.0.0.1:7860/sdapi/v1/options )一致。
- 确保stable diffusion webui部署成功且能访问
- 安装包解压,并确保只把pictureChange文件夹plugins目录里面,之后把
config.json.template
复制为config.json
,并修改其中的参数和规则。 具体如下
# config.json文件内容示例
{
"max_number":3, #最大并行人数量
#申请地址https://ai.baidu.com/ai-doc
"api_key" : "你的百度云api_key",
"secret_key" : "你的百度云secret_key",
"use_group": [],#不用填
"start": {
"host": "你的sd画图的ip",#填上你的ip
"port": 80,#填上你的ip的端口号
"use_https": false
},
"defaults": {
"params": {
"sampler_name": "DPM++ 2M Karras",
"steps": 20,
"width": 512,
"height": 512,
"cfg_scale": 7,
"prompt": "absurdres, 8k",
"negative_prompt": "(((nsfw))),EasyNegative,badhandv4,ng_deepnegative_v1_75t,(worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy,DeepNegative, skin spots, acnes, skin blemishes,(fat:1.2),facing away, looking away,tilted head, lowres,bad anatomy,bad hands, missing fingers,extra digit, fewer digits,bad feet,poorly drawn hands,poorly drawn face,mutation,deformed,extra fingers,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,teethcroppe,signature, watermark, username,blurry,cropped,jpeg artifacts,text,error,Lower body exposure",#可自定义
"enable_hr": false,
"hr_scale": 2,
"hr_upscaler": "Latent",
"hr_second_pass_steps": 15,
"denoising_strength": 0.7
},
"options": {
"sd_model_checkpoint": "填上你的sd画图模型" #填上你下载的模型
}
},
"rules": [
{
"keywords": [
"横版",
"壁纸"
],
"params": {
"width": 640,
"height": 384
},
"desc": "分辨率会变成640x384"
},
{
"keywords": [
"竖版"
],
"params": {
"width": 384,
"height": 640
}
},
{
"keywords": [
"高清"
],
"params": {
"enable_hr": true,
"hr_scale": 1.6
},
"desc": "出图分辨率长宽都会提高1.6倍"
},
{
"keywords": [
"二次元"
],
"params": {
"negative_prompt": "(((nsfw))),EasyNegative,badhandv4,ng_deepnegative_v1_75t,(worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy,DeepNegative, skin spots, acnes, skin blemishes,(fat:1.2),facing away, looking away,tilted head, lowres,bad anatomy,bad hands, missing fingers,extra digit, fewer digits,bad feet,poorly drawn hands,poorly drawn face,mutation,deformed,extra fingers,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,teethcroppe,signature, watermark, username,blurry,cropped,jpeg artifacts,text,error,Lower body exposure",
"prompt": "masterpiece, best quality"
},
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
},
"desc": "使用二次元风格模型出图"
},
{
"keywords": [
"现实"
],
"params": {
"negative_prompt": "(((nsfw))),EasyNegative,badhandv4,ng_deepnegative_v1_75t,(worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy,DeepNegative, skin spots, acnes, skin blemishes,(fat:1.2),facing away, looking away,tilted head, lowres,bad anatomy,bad hands, missing fingers,extra digit, fewer digits,bad feet,poorly drawn hands,poorly drawn face,mutation,deformed,extra fingers,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,teethcroppe,signature, watermark, username,blurry,cropped,jpeg artifacts,text,error,Lower body exposure",
"prompt": "masterpiece, best quality"
},
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
},
"desc": "使用现实风格模型出图"
}
],
"roles": [
{
"title": "👧 可爱女生",
"prompt": "",
"negative_prompt": "paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, extra fingers, fewer fingers, ((watermark:2)), (white letters:1), (multi nipples), bad anatomy, bad hands, text, error, missing fingers, missing arms, missing legs, extra digit, fewer digits, cropped, worst quality, jpeg artifacts, signature, watermark, username, bad feet, Multiple people, blurry, poorly drawn hands, poorly drawn face, mutation, deformed, extra limbs, extra arms, extra legs, malformed limbs, fused fingers, too many fingers, long neck, cross-eyed, mutated hands, polar lowres, bad body, bad proportions, gross proportions, wrong feet bottom render, abdominal stretch, briefs, knickers, kecks, thong, fused fingers, bad body,bad proportion body to legs, wrong toes, extra toes, missing toes, weird toes, 2 body, 2 pussy, 2 upper, 2 lower, 2 head, 3 hand, 3 feet, extra long leg, super long leg, mirrored image, mirrored noise,, badhandv4, ng_deepnegative_v1_75t",
"denoising_strength": 0.4,
"cfg_scale": 8.0,
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
}
},
{
"title": "🧑 帅气男神",
"prompt": "boy, male focus, topless male, messy hair, looking at viewer, outdoors, beautiful lighting, deep shadow, best quality, masterpiece, ultra highres, photorealistic, blurry background,",
"negative_prompt": "cartoon, anime, sketches,(worst quality, low quality), (deformed, distorted, disfigured), (bad eyes, wrong lips, weird mouth, bad teeth, mutated hands and fingers:1.2), bad anatomy, wrong anatomy, amputation, extra limb, missing limb, floating limbs, disconnected limbs, mutation, ugly, disgusting, (bad_pictures, negative_hand-neg:1.2)",
"denoising_strength": 0.4,
"cfg_scale": 8.0,
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
}
},
{
"title": "💑 二次元情侣",
"prompt": "absurdres, highres, ultra detailed, (:1.3), BREAK , Create a vintage advertisement, with retro design elements, classic typography, and a nostalgic atmosphere. BREAK , Create an image of a half-human, half-dragon hybrid, with a combination of physical features and powers from both of their parentage. BREAK , Create an image with a shallow depth of field, focusing on the subject and blurring the background for a sense of depth and separation. BREAK , Illustrate an old-town street, with historic buildings, cobblestone streets, and a sense of charm and nostalgia. BREAK , Capture a tender moment between a couple, showcasing their love, intimacy, and emotional connection. BREAK , Illustrate an image using soft pastel colors, with a gentle, dreamy quality and a focus on light and atmosphere.",
"negative_prompt": "EasyNegative, (worst quality, low quality:1.4), nsfw, (blush:1.3), logo",
"denoising_strength": 0.4,
"cfg_scale": 8.0,
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
}
},
{
"title": "🤖 机甲女孩",
"prompt": "absurdres, highres, ultra detailed, (1girl:1.3), BREAK , Sun Knight, solar magic, light manipulation, radiant power, sunbeam attacks, aura of warmth, shining armor BREAK , photo manipulation, altered realities, fantastical scenes, digital artistry, creative editing, evocative narratives, striking visuals BREAK , kinetic art, moving sculptures, mechanical creations, interactive installations, dynamic motion, engineering ingenuity, captivating visuals",
"negative_prompt": "EasyNegative, (worst quality, low quality:1.4), nsfw",
"denoising_strength": 0.35,
"cfg_scale": 7.0,
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
}
},
{
"title": "🌸 樱花女孩",
"prompt": "(masterpiece, high quality, highres,illustration),blurry background,[(white background:1.2)::5],cowboy shot, spring (season),(no light:1.1),(temptation:1.2),elegance, (1loli:1.1),(very long hair:1.1),(blush:0.7),floating hair,ahoge,deep sky,star (sky), (summer (Floral:1.2) dress:1.1),outline,(see-through:0.85),shining,low twintails, (polychromatic peony:1.15),Movie poster,(colorful:1.1),ornament,petals,(pantyhose:1.1), ribbon",
"negative_prompt": "sketch, duplicate, ugly, huge eyes, text, logo, worst face, (bad and mutated hands:1.3), (worst quality:2.0), (low quality:2.0), (blurry:2.0), horror, geometry, bad_prompt, (bad hands), (missing fingers), multiple limbs, bad anatomy, (interlocked fingers:1.2), Ugly Fingers, (extra digit and hands and fingers and legs and arms:1.4), ((2girl)), (deformed fingers:1.2), (long fingers:1.2),(bad-artist-anime), bad-artist, bad hand, extra legs, nipples,nsfw, Size: 576x832, Seed: 969039108, Model: MAADBD2fp16, Steps: 20, (blurry: 2.0), horror, geometry, bad_prompt, (bad hands), (missing fingers), multiple limbs, bad anatomy, Version: v1.3.2, Sampler: DPM++ 2M Karras, CFG scale: 8, Clip skip: 2, Model hash: cca17b08da, Hires steps: 20, (low quality: 2.0), (long fingers: 1.2),(bad-artist-anime), bad-artist, bad hand, extra legs, nipples,nsfw, Hires upscale: 2, (worst quality: 2.0), Hires upscaler: Latent, (deformed fingers: 1.2), Denoising strength: 0.5, (interlocked fingers: 1.2), Ugly Fingers, (bad and mutated hands: 1.3), Wildcard negative prompt: sketch, duplicate, ugly, huge eyes, text, logo, worst face, (extra digit and hands and fingers and legs and arms: 1.4), ((2girl))",
"denoising_strength": 0.4,
"cfg_scale": 8.0,
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
}
},
{
"title": "☁ 炫彩天空湖",
"prompt": "Golden Dream Starry Sky,Distant mountains,A crystal clear lake,Fluorescent lake surface,The grass is full of flowers,landscape photography by Marc Adamus,realistic, 8K, ultrawide angle, panorama, 3D,Ultra HD, high pixel,HD --ar 9:16 --test --creative --upbeta",
"negative_prompt": "",
"denoising_strength": 0.4,
"cfg_scale": 8.0,
"options": {
"sd_model_checkpoint": "填上你的sd画图模型"#填上你下载的模型
}
}
]
}
PS: 如果你下载了多个模型,就可以根据实际需要,填入你想要的模型 请确保你填入的模型是你下载过的模型,且模型能正常使用!
- 修改文件
- 直接把chat_channel.py覆盖你的chatgpt-on-wechat\channel\chat_channel.py
- 直接把godcmd.py覆盖你的chatgpt-on-wechat\plugins\godcmd\godcmd.py
- 在根目录config.json和config.py分别添加下面代码
- config.json
"group_imageChange": true,默认为True
- config.py
"group_imageChange": False,默认为True
-
直接把godcmd.py覆盖你的chatgpt-on-wechat\plugins\godcmd\godcmd.py
-
安装依赖
#进入pictureChange文件夹安装依赖
pip3 install -r requirements.txt
- 图生图
- 画图
- 支持放大 变换操作