-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
Hello,
I have a question—apologies if this is obvious. I'm trying to provide an input image along with a text prompt while having enhancement enabled ("After First Enhancement" option enabled).
I tested both /v2/generation/text-to-image-with-ip and /v2/generation/image-prompt. While they generate images, the server logs show:
[Enhance] Skipping, preconditions aren't met
Additionally, when I post the same parameters to /v2/generation/image-enhance, the server returns a 500 Internal Server Error with this traceback:
UnboundLocalError: local variable 'input_image_bytes' referenced before assignment
Below are my parameters and code:
import requests
import json
import base64
import io
host = "http://127.0.0.1:1111"
source = open("C:\\Users\\Deadpipe\\Downloads\\test.png", "rb").read()
image = base64.b64encode(source).decode('utf-8')
def image_prompt(params: dict) -> dict:
response = requests.post(
url=f"{host}/v2/generation/text-to-image-with-ip",
data=json.dumps(params),
headers={"Content-Type": "application/json"}
)
return response.json()
params = {
"prompt": "Elegant and modern living room",
"negative_prompt": "low light, night light, dim light",
"style_selections": [
"Fooocus Photograph"
],
"performance_selection": "Quality",
"aspect_ratios_selection": "1024*1024",
"image_number": 1,
"image_seed": -1,
"sharpness": 2,
"guidance_scale": 4,
"base_model_name": "juggernautXL_v8Rundiffusion.safetensors",
"refiner_model_name": "None",
"refiner_switch": 0.5,
"loras": [
{
"enabled": True,
"model_name": "sd_xl_offset_example-lora_1.0.safetensors",
"weight": 0.1
},
{
"enabled": False,
"model_name": "None",
"weight": 1
},
{
"enabled": False,
"model_name": "None",
"weight": 1
},
{
"enabled": False,
"model_name": "None",
"weight": 1
},
{
"enabled": False,
"model_name": "None",
"weight": 1
}
],
"advanced_params": {
"adaptive_cfg": 7,
"adm_scaler_end": 0.3,
"adm_scaler_negative": 0.8,
"adm_scaler_positive": 1.5,
"black_out_nsfw": False,
"canny_high_threshold": 128,
"canny_low_threshold": 64,
"clip_skip": 2,
"controlnet_softness": 0.25,
"debugging_cn_preprocessor": False,
"debugging_dino": False,
"debugging_enhance_masks_checkbox": False,
"debugging_inpaint_preprocessor": False,
"dino_erode_or_dilate": 0,
"disable_intermediate_results": False,
"disable_preview": True,
"disable_seed_increment": False,
"freeu_b1": 1.01,
"freeu_b2": 1.02,
"freeu_enabled": False,
"freeu_s1": 0.99,
"freeu_s2": 0.95,
"inpaint_advanced_masking_checkbox": True,
"inpaint_disable_initial_latent": False,
"inpaint_engine": "v2.6",
"inpaint_erode_or_dilate": 0,
"inpaint_respective_field": 1,
"inpaint_strength": 1,
"invert_mask_checkbox": False,
"mixing_image_prompt_and_inpaint": False,
"mixing_image_prompt_and_vary_upscale": False,
"overwrite_height": -1,
"overwrite_step": -1,
"overwrite_switch": -1,
"overwrite_upscale_strength": -1,
"overwrite_vary_strength": -1,
"overwrite_width": -1,
"refiner_swap_method": "joint",
"sampler_name": "dpmpp_2m_sde_gpu",
"scheduler_name": "karras",
"skipping_cn_preprocessor": False,
"vae_name": "Default (model)"
},
"save_meta": True,
"meta_scheme": "fooocus",
"save_extension": "png",
"save_name": "test",
"read_wildcards_in_order": False,
"require_base64": False,
"async_process": False,
"webhook_url": "",
"image_prompts": [
{
"cn_img": image,
"cn_stop": 0.6,
"cn_weight": 1.6,
"cn_type": "PyraCanny"
}
],
"enhance_input_image": "",
"enhance_checkbox": True,
"enhance_uov_method": "Upscale (2x)",
"enhance_uov_processing_order": "After First Enhancement",
"enhance_uov_prompt_type": "Original Prompts",
"save_final_enhanced_image_only": True,
"enhance_ctrlnets": [
{
"enhance_enabled": False,
"enhance_mask_dino_prompt": "face",
"enhance_prompt": "",
"enhance_negative_prompt": "",
"enhance_mask_model": "sam",
"enhance_mask_cloth_category": "full",
"enhance_mask_sam_model": "vit_b",
"enhance_mask_text_threshold": 0.25,
"enhance_mask_box_threshold": 0.3,
"enhance_mask_sam_max_detections": 0,
"enhance_inpaint_disable_initial_latent": False,
"enhance_inpaint_engine": "v2.6",
"enhance_inpaint_strength": 1,
"enhance_inpaint_respective_field": 0.618,
"enhance_inpaint_erode_or_dilate": 0,
"enhance_mask_invert": False
}
],
}
result = image_prompt(params)
print(json.dumps(result, indent=4, ensure_ascii=False))
Could you please let me know if I am missing something? Thank you for your time!
Metadata
Metadata
Assignees
Labels
No labels