diff --git a/BaiHu/Image/12/1.png b/BaiHu/Image/12/1.png new file mode 100644 index 00000000..eed12103 Binary files /dev/null and b/BaiHu/Image/12/1.png differ diff --git a/BaiHu/Image/12/2.png b/BaiHu/Image/12/2.png new file mode 100644 index 00000000..6ddc1352 Binary files /dev/null and b/BaiHu/Image/12/2.png differ diff --git a/BaiHu/Image/12/3.png b/BaiHu/Image/12/3.png new file mode 100644 index 00000000..f86c7201 Binary files /dev/null and b/BaiHu/Image/12/3.png differ diff --git a/BaiHu/Image/12/4.png b/BaiHu/Image/12/4.png new file mode 100644 index 00000000..b845243a Binary files /dev/null and b/BaiHu/Image/12/4.png differ diff --git a/BaiHu/Image/12/5.png b/BaiHu/Image/12/5.png new file mode 100644 index 00000000..3b00c38c Binary files /dev/null and b/BaiHu/Image/12/5.png differ diff --git a/BaiHu/JSON/12_1.json b/BaiHu/JSON/12_1.json new file mode 100644 index 00000000..fe8ede2c --- /dev/null +++ b/BaiHu/JSON/12_1.json @@ -0,0 +1,57 @@ +{ + "override_settings": { + "sd_model_checkpoint": "AgainMixChibi_1G_pvc.safetensors [14f479afc2]", + "sd_vae": "Automatic" + }, + "prompt": "(best quality:1.4),(masterpiece:1.4),(8K:1.4),(extremely detailed:1.4),1gril,(black eyes:1.2),(black hair:1.2),beret.headphones,full body,(chibi:1.4),smile,,", + "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": 25, + "sampler_name": "DPM++ 2M Karras", + "width": 1024, + "height": 1472, + "batch_size": 1, + "n_iter": 1, + "seed": 1, + "cfg_scale": 7, + "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_instant_id_sdxl [eb2d3ec0]", + "module": "instant_id_face_embedding", + "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" + }, + { + "enabled": true, + "model": "control_instant_id_sdxl [c5c25a50]", + "module": "instant_id_face_keypoints", + "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": "ControlNet is more important" + } + ] + } + } +} \ No newline at end of file diff --git a/BaiHu/Test/TestImg2Img.py b/BaiHu/Test/TestImg2Img.py index 62dea920..9e0a8c7d 100644 --- a/BaiHu/Test/TestImg2Img.py +++ b/BaiHu/Test/TestImg2Img.py @@ -1,20 +1,21 @@ +import os + from Util.CommonUtil import * # API地址 url = "http://192.168.1.21:7860" -# 用户输入的源图 -input_source_img = '../Image/1ae93e2587822c291362abf9504cb49ec.jpeg' -# 输出图片 -output_file = "../Out/Result.png" # 图生图函数 -def img2img(url,model_id, prompt_id, input_source_img, output_file): +def img2img(url, model_id, prompt_id, input_source_img, output_file): # JSON文件模板 templet_file = r'../JSON/' + str(model_id) + '_' + str(prompt_id) + '.json' # 模型图片 input_refer_img = '../Image/' + str(model_id) + '/' + str(prompt_id) + '.jpg' + if not os.path.exists(input_refer_img): + input_refer_img = '../Image/' + str(model_id) + '/' + str(prompt_id) + '.png' + # 读取JSON文件 with open(templet_file, 'r', encoding='utf-8') as file: payload = json.load(file) @@ -38,5 +39,10 @@ def img2img(url,model_id, prompt_id, input_source_img, output_file): # 保存图片 save_encoded_image(response.json()['images'][0], output_file) + +# 用户输入的源图 +input_source_img = '../Image/1ae93e2587822c291362abf9504cb49ec.jpeg' +# 输出图片 +output_file = "../Out/Result.png" # 调用图生图 -img2img(url, 28, 1, input_source_img, output_file) +img2img(url, 12, 1, input_source_img, output_file)