Replicate SD Inpainting 功能
▼
Authorization
在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
请求参数
Header 参数
Authorization
string
可选
示例: Bearer {{YOUR_API_KEY}}
Content-Type
string
可选
示例: application/json
Body 参数 application/json
version
string
必需
模型版本ID
input
object
必需
模型输入参数
mask
string
必需
黑白图像,用作遮罩,用于对提供的图像进行修复。白色像素将被修复,黑色像素将被保留。
image
string
必需
用于生成变体的初始图像。将调整为高 x 宽。
width
integer
可选
生成图像的宽度(像素)。需要为 64 的倍数。默认值:512。
height
integer
可选
生成图像的高度(像素)。需要为 64 的倍数。默认值:512。
prompt
string
可选
输入提示
scheduler
string
可选
选择一个调度程序。默认值:"DPMSolverMultistep"。
num_outputs
integer
可选
要生成的图像数量。默认值:1。最小值:1,最大值:4。
guidance_scale
number
可选
无分类器引导尺度。默认值:7.5。最小值:1,最大值:20。
num_inference_steps
integer
可选
去噪步骤数。默认值:50。最小值:1,最大值:500。
示例
{
"version": "stability-ai/stable-diffusion-inpainting:95b7223104132402a9ae91cc677285bc5eb997834bd2349fa486f53910fd68b3",
"input": {
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench"
}
}
请求示例代码
curl --location --request POST 'https://api.quickrouter.ai/replicate/v1/predictions' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
"version": "stability-ai/stable-diffusion-inpainting:95b7223104132402a9ae91cc677285bc5eb997834bd2349fa486f53910fd68b3",
"input": {
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench"
}
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"version": "stability-ai/stable-diffusion-inpainting:95b7223104132402a9ae91cc677285bc5eb997834bd2349fa486f53910fd68b3",
"input": {
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench"
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.quickrouter.ai/replicate/v1/predictions", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("api.quickrouter.ai")
payload = json.dumps({
"version": "stability-ai/stable-diffusion-inpainting:95b7223104132402a9ae91cc677285bc5eb997834bd2349fa486f53910fd68b3",
"input": {
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench"
}
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
conn.request("POST", "/replicate/v1/predictions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
返回响应
响应参数 application/json
id
string
可选
任务ID
status
string
可选
任务状态
output
string
可选
任务输出
示例
{
"id": "qpt5jq1fssrmc0cmd5hvy31mdg",
"status": "starting"
}