使用 lcm 进行图像到图像
POST
/v3/lcm-img2img通过潜在一致性模型,图像生成速度提高 10 倍,通过几步推理即可合成高分辨率图像。您可以在这里获取指导:https://novita.ai/get-started/Basic_img2img.html#_5-img2img-request-with-lcm
请求参数
对于不同的稳定扩散模型,您使用提示得到的结果可能会有所不同。您可以调用 https://docs.novita.ai/models-api/query-model 端点来检索“sd_name_in_api”字段作为“model_name”。
输入图像的base64,最大分辨率为2048 * 2048,最大文件大小为30 Mb,返回的图像将与输入图像的大小相同。
涂鸦的正面提示词,用“,”分隔。范围:[1, 1024]
否定提示词,用“,”分隔,还可以添加“badhandv4_16755”等嵌入(文本反转)模型。
图像编号。范围:[1, 16]
VAE(Variational Auto Encoder),sd_vae 可以在端点 https://docs.novita.ai/models-api/query-model 中使用查询参数 'filter.types=vae' 访问,如 'sd_name': 'customVAE.safetensors '
VAE(Variational Auto Encoder),sd_vae 可以在端点 https://docs.novita.ai/models-api/query-model 中使用查询参数 'filter.types=vae' 访问,如 'sd_name': 'customVAE.safetensors '
文本反转选项,当前支持最多 5 个嵌入
图像创建过程的迭代。范围:[1, 8]
该设置表示模型将听取您的提示的程度,建议设置为 0。范围:[0, 30.0]
剪辑跳过,必须大于 0
{
"model_name": "dreamshaper_8_93211.safetensors",
"input_image": "{{base64 encoded image}}",
"prompt": "1girl",
"negative_prompt": "",
"image_num": 1,
"sd_vae": "vae-ft-mse-840000-ema-pruned.safetensors",
"loras": [
{
"model_name": "more_details_59655",
"strenth": "0.5"
},
{
"model_name": "Gothpunk_30978",
"strenth": 0.5
}
],
"embeddings": [
{
"model_name": "AS-YoungV2"
},
{
"model_name": "MidAged"
}
],
"steps": 4,
"guidance_scale": 0,
"seed": 123,
"clip_skip": 1
}
示例代码
返回响应
[
[
{
"image_url": "",
"image expire time": null,
"image_type": ""
}
],
[
{
"image_url": "https://faas-output-image.s3.ap-southeast-1.amazonaws.com/test/lcm_img2img_e1ca4ee4-aa69-4073-94ab-f2dddc6bf7fc_0.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIASVPYCN6LRCW3SOUV%2F20231201%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=20231201T081801Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=4d9d50cf00116cea5409acbef51caaf023f805804be3f13efcb980982a2b4d46",
"image_url_ttl": "3600",
"image_type": "jpeg"
},
{
"image_url": "https://faas-output-image.s3.ap-southeast-1.amazonaws.com/test/lcm_img2img_e1ca4ee4-aa69-4073-94ab-f2dddc6bf7fc_0.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIASVPYCN6LRCW3SOUV%2F20231201%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=20231201T081801Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=4d9d50cf00116cea5409acbef51caaf023f805804be3f13efcb980982a2b4d46",
"image_url_ttl": "3600",
"image_type": "jpeg"
}
]
]