main
黄海 1 year ago
parent 26d3e83b46
commit f2ad2eda50

@ -5,7 +5,7 @@ from urllib.parse import urlparse
from tqdm import tqdm
from Util import ConfigUtil
from Util.AesUtil import *
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util.CommonUtil import *
from Util.Logger import Logger
from Util.OssUtil import uploadOss

@ -0,0 +1,19 @@
https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/14135
add to args in webui-user.bat --api-server-stop to activate endpoints:
```
/sdapi/v1/server-kill
/sdapi/v1/server-restart
/sdapi/v1/server-stop
```
# 添加启动参数
def main():
import sys
# --api-server-stop
#sys.argv.append("--no-half")
sys.argv.append("--api-server-stop")
if args.dump_sysinfo:
filename = launch_utils.dump_sysinfo()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

@ -0,0 +1,43 @@
{
"override_settings": {
"sd_model_checkpoint": "C-2.5D-Eleventhversion-Q版_v11.0.safetensors [a635ab0dee]",
"sd_vae": "Automatic"
},
"prompt": "chibi,1 girl,gray hair,blue eyes,bucket hat,with backpack,anxious,forest,Astral,((night) ),(running),(((chasing fireflies with a bug net))),The light of the firefly.(beautiful detailed face),(beautiful detailed eyes),.small backpac.,<lora:ip-adapter-faceid-plusv2_sd15_lora:1>,",
"negative_prompt": "NSFW,blurry,low quality,watermark,monochrome,badhandv4,easynegative,ng_deepnegative_v1_75t,bad proportions,mutated hands and fingers,poorly drawn face,extra limb,missing limb,malformed limbs,disconnected limbs,ugly,floating limbs,extra legs,mutation,bad body,long neck,cross-eyed,text,cleavage,",
"steps": 23,
"sampler_name": "DPM++ 2M Karras",
"width": 768,
"height": 1152,
"batch_size": 1,
"n_iter": 1,
"seed": 1,
"cfg_scale": 6,
"CLIP_stop_at_last_layers": 2,
"init_images": [
"string"
],
"restore_faces": false,
"enable_hr": true,
"denoising_strength": 0.5,
"alwayson_scripts": {
"ControlNet": {
"args": [
{
"enabled": true,
"model": "ip-adapter-faceid-plusv2_sd15 [6e14fc1a]",
"module": "ip-adapter_face_id_plus",
"weight": 1,
"resize_mode": "Crop and Resize",
"guidance_start": 0,
"guidance_end": 1,
"pixel_perfect": true,
"processor_res": 512,
"save_detected_map": true,
"input_image": "string",
"control_mode": "My prompt is more important"
}
]
}
}
}

@ -0,0 +1,43 @@
{
"override_settings": {
"sd_model_checkpoint": "C-2.5D-Eleventhversion-Q版_v11.0.safetensors [a635ab0dee]",
"sd_vae": "Automatic"
},
"prompt": "chibi,1girl,solo,long hair,cute,smile,open mouth,flower,outdoors,playing guitar,music,beret,holding guitar,jacket,shirt,shorthair,cherry blossoms,<lora:ip-adapter-faceid-plusv2_sd15_lora:1>,",
"negative_prompt": "NSFW,blurry,low quality,watermark,monochrome,badhandv4,easynegative,ng_deepnegative_v1_75t,bad proportions,mutated hands and fingers,poorly drawn face,extra limb,missing limb,malformed limbs,disconnected limbs,ugly,floating limbs,extra legs,mutation,bad body,long neck,cross-eyed,text,cleavage,",
"steps": 23,
"sampler_name": "DPM++ 2M Karras",
"width": 768,
"height": 1152,
"batch_size": 1,
"n_iter": 1,
"seed": 1,
"cfg_scale": 6,
"CLIP_stop_at_last_layers": 2,
"init_images": [
"string"
],
"restore_faces": false,
"enable_hr": true,
"denoising_strength": 0.5,
"alwayson_scripts": {
"ControlNet": {
"args": [
{
"enabled": true,
"model": "ip-adapter-faceid-plusv2_sd15 [6e14fc1a]",
"module": "ip-adapter_face_id_plus",
"weight": 1,
"resize_mode": "Crop and Resize",
"guidance_start": 0,
"guidance_end": 1,
"pixel_perfect": true,
"processor_res": 512,
"save_detected_map": true,
"input_image": "string",
"control_mode": "My prompt is more important"
}
]
}
}
}

@ -0,0 +1,43 @@
{
"override_settings": {
"sd_model_checkpoint": "C-2.5D-Eleventhversion-Q版_v11.0.safetensors [a635ab0dee]",
"sd_vae": "Automatic"
},
"prompt": "chibi, 1girl, solo, long hair, white shirt, jeans, sitting, ndoors,<lora:ip-adapter-faceid-plusv2_sd15_lora:1>,",
"negative_prompt": "NSFW,blurry,low quality,watermark,monochrome,badhandv4,easynegative,ng_deepnegative_v1_75t,bad proportions,mutated hands and fingers,poorly drawn face,extra limb,missing limb,malformed limbs,disconnected limbs,ugly,floating limbs,extra legs,mutation,bad body,long neck,cross-eyed,text,cleavage,",
"steps": 23,
"sampler_name": "DPM++ 2M Karras",
"width": 768,
"height": 1152,
"batch_size": 1,
"n_iter": 1,
"seed": 1,
"cfg_scale": 6,
"CLIP_stop_at_last_layers": 2,
"init_images": [
"string"
],
"restore_faces": false,
"enable_hr": true,
"denoising_strength": 0.5,
"alwayson_scripts": {
"ControlNet": {
"args": [
{
"enabled": true,
"model": "ip-adapter-faceid-plusv2_sd15 [6e14fc1a]",
"module": "ip-adapter_face_id_plus",
"weight": 1,
"resize_mode": "Crop and Resize",
"guidance_start": 0,
"guidance_end": 1,
"pixel_perfect": true,
"processor_res": 512,
"save_detected_map": true,
"input_image": "string",
"control_mode": "My prompt is more important"
}
]
}
}
}

@ -0,0 +1,43 @@
{
"override_settings": {
"sd_model_checkpoint": "C-2.5D-Eleventhversion-Q版_v11.0.safetensors [a635ab0dee]",
"sd_vae": "Automatic"
},
"prompt": "chibi,1girl,solo,long hair,mecha,full body,<lora:ip-adapter-faceid-plusv2_sd15_lora:1>",
"negative_prompt": "NSFW,blurry,low quality,watermark,monochrome,badhandv4,easynegative,ng_deepnegative_v1_75t,bad proportions,mutated hands and fingers,poorly drawn face,extra limb,missing limb,malformed limbs,disconnected limbs,ugly,floating limbs,extra legs,mutation,bad body,long neck,cross-eyed,text,cleavage,",
"steps": 23,
"sampler_name": "DPM++ 2M Karras",
"width": 768,
"height": 1152,
"batch_size": 1,
"n_iter": 1,
"seed": 1,
"cfg_scale": 6,
"CLIP_stop_at_last_layers": 2,
"init_images": [
"string"
],
"restore_faces": false,
"enable_hr": true,
"denoising_strength": 0.5,
"alwayson_scripts": {
"ControlNet": {
"args": [
{
"enabled": true,
"model": "ip-adapter-faceid-plusv2_sd15 [6e14fc1a]",
"module": "ip-adapter_face_id_plus",
"weight": 1,
"resize_mode": "Crop and Resize",
"guidance_start": 0,
"guidance_end": 1,
"pixel_perfect": true,
"processor_res": 512,
"save_detected_map": true,
"input_image": "string",
"control_mode": "My prompt is more important"
}
]
}
}
}

@ -0,0 +1,43 @@
{
"override_settings": {
"sd_model_checkpoint": "C-2.5D-Eleventhversion-Q版_v11.0.safetensors [a635ab0dee]",
"sd_vae": "Automatic"
},
"prompt": "MakotoShinkaiStyle,a cute little girl sitting on the grass,looking up at the blue night sky,the sky and grass as the background,the central composition,evening,color dark soft,style,cartoonish,the best quality,<lora:ip-adapter-faceid-plusv2_sd15_lora:1>,",
"negative_prompt": "NSFW,blurry,low quality,watermark,monochrome,badhandv4,easynegative,ng_deepnegative_v1_75t,bad proportions,mutated hands and fingers,poorly drawn face,extra limb,missing limb,malformed limbs,disconnected limbs,ugly,floating limbs,extra legs,mutation,bad body,long neck,cross-eyed,text,cleavage,",
"steps": 23,
"sampler_name": "DPM++ 2M Karras",
"width": 768,
"height": 1152,
"batch_size": 1,
"n_iter": 1,
"seed": 1,
"cfg_scale": 6,
"CLIP_stop_at_last_layers": 2,
"init_images": [
"string"
],
"restore_faces": false,
"enable_hr": true,
"denoising_strength": 0.5,
"alwayson_scripts": {
"ControlNet": {
"args": [
{
"enabled": true,
"model": "ip-adapter-faceid-plusv2_sd15 [6e14fc1a]",
"module": "ip-adapter_face_id_plus",
"weight": 1,
"resize_mode": "Crop and Resize",
"guidance_start": 0,
"guidance_end": 1,
"pixel_perfect": true,
"processor_res": 512,
"save_detected_map": true,
"input_image": "string",
"control_mode": "My prompt is more important"
}
]
}
}
}

@ -7,7 +7,7 @@
# 参考https://blog.csdn.net/it_is_arlon/article/details/130359239
import os
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util import ConfigUtil

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from natsort import natsorted
def C16(prompt_data, img, source_code, target_code, model_id, user_id):

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
def C19(prompt_data, img, source_code, target_code):

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
def C19(prompt_data, img, source_code, target_code):

@ -2,7 +2,7 @@ import os
import random
from Util.PngUtil import *
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util.CommonUtil import *
from Util.OssUtil import uploadOss

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
def C22(prompt_data, img, source_code, target_code, idx):

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
def C22(prompt_data, img):

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
def C23(prompt_data, img, source_code, target_code):

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
def C24(prompt_data, img, source_code, target_code):

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
import random

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
import random

@ -1,7 +1,7 @@
import os
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
import random

@ -2,7 +2,7 @@ import os
import random
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util.CommonUtil import *

@ -2,7 +2,7 @@ import os
import random
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util.CommonUtil import *

@ -2,7 +2,7 @@ import os
import random
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util.CommonUtil import *

@ -1,5 +1,5 @@
from Util import ConfigUtil
from Util.ComfyUIUtil import *
from Util.SDUtil import *
# 打开配置文件
config = ConfigUtil.getConfig()
@ -14,8 +14,14 @@ info = get_comfyui_used(comfyui_address)
print(info)
# 获取使显存数量
get_webui_used(webui_address)
# 清理缓存
clear_webui_cache(webui_address)
# 获取使显存数量
get_webui_used(webui_address)
total, used = get_webui_used(webui_address)
# 显卡显存占用超过20GB
if float(used) > 20:
print("发现显存占用高达" + used + "GB准备重启SD...")
# 重新启动一下SD
restart_server(webui_address)
# 休息2分钟以保证SD重启完成
time.sleep(2 * 60)
else:
print("显存占用正常无法重新启动SD")

@ -6,10 +6,10 @@ from Util.PgUtil import *
sql = "INSERT INTO t_hy_model(model_id,model_name,memo,star,update_time,img_count,b_use,sort_id,model_type_id,style_id,is_cover) VALUES (%s,%s, %s,%s,now(),%s,1,1,%s,%s,%s);"
# 模型编号
model_id = 44
model_id = 45
# 模型名称
model_name = '黏土世界'
model_name = '治愈风二次元'
# 提示信息
memo = '1、请上传正面半身照。; 2、确保脸部无遮挡3、图片要求不小于1.5MB(正常手机拍照即可)'

@ -1,4 +1,3 @@
import json
import os.path
import time
import urllib.parse
@ -180,12 +179,13 @@ def get_webui_used(webui_server):
print("显存:" + total + "GB,已使用:" + used + "GB,使用率:" + str(used_lv) + '%')
else:
print("调用集成的获取显卡显存代码失败!")
return total, used
# 清理webui的缓存
def clear_webui_cache(webui_server):
def clear_webui_cache(webui_address):
# webui 服务器地址
empty_cache_url = "http://{}/sdapi/v1/empty_cache".format(webui_server)
empty_cache_url = "http://{}/sdapi/v1/empty_cache".format(webui_address)
res = submit_post(empty_cache_url, None)
if res.status_code == 200:
jo = json.loads(res.text)
@ -195,3 +195,9 @@ def clear_webui_cache(webui_server):
print("显存清理失败!")
else:
print("调用集成的清理显卡显存代码失败!")
# 重新启动SD
def restart_server(webui_address):
server_restart_url = "http://{}/sdapi/v1/server-restart".format(webui_address)
submit_post(server_restart_url, None)

@ -5,7 +5,7 @@ from urllib.parse import urlparse
from Util import ConfigUtil
from Util.AesUtil import *
from Util.ComfyUIUtil import *
from Util.SDUtil import *
from Util.CommonUtil import *
from Util.OssUtil import uploadOss
from Util.PngUtil import *
@ -33,8 +33,8 @@ def webui_txt_2_img(model_id, json_data, input_image, target_folder):
# 图片
args = json_data['alwayson_scripts']['ControlNet']['args']
#pretty_json = json.dumps(json_data, indent=4,ensure_ascii=False)
#print(pretty_json)
# pretty_json = json.dumps(json_data, indent=4,ensure_ascii=False)
# print(pretty_json)
pose_image = json_data['pose_image']
args[0]['input_image'] = encode_image(input_image[0])
@ -143,7 +143,6 @@ def download_image(image_url, file_path):
printf('图片下载失败,状态码:' + str(response.status_code))
# 根据输入的图片集合,填充到
def fill_input(prompt_data, file_array):
# 是不是不存在配置节
@ -329,7 +328,7 @@ if __name__ == '__main__':
# 清理SD缓存
clear_webui_cache(webui_address)
get_webui_used(webui_address)
total, used = get_webui_used(webui_address)
# 清理GPU缓存
clear_comfyui_cache(comfyui_address)

Loading…
Cancel
Save