Appearance
SD 绘画 API
请求地址
POST 方法:/api/word/sd
请求参数
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
positive | string | 是 | 正向描述词 |
negative | string | 是 | 反向描述词 |
width | int | 是 | 图片宽度:需要 64 的倍数,示例:512 |
height | int | 是 | 图片高度:需要 64 的倍数,示例:512 |
step | int | 是 | 推理步数,eluer_a 采样建议 15 左右;dpm_plus 采样下 40 及以上 |
num | int | 是 | 生成数量,示例:1 |
model | string | 是 | 模型,示例:dark_sushi_25d |
sample | string | 是 | 采样方法[二选一],eluer_a 或 dpm_plus |
seed | int | 是 | 随机值,示例 5201314 |
gpu | bool | 是 | GPU 开关,示例 true |
示例代码
python
import requests
url = 'http://127.0.0.1:5699/api/word/sd'
data = {
'positive': 'masterpiece,floating hair, girl',
'negative': 'bad hands, text',
'width': 512,
'height': 512,
'step': 15,
'num': 1,
'model': 'dark_sushi_25d',
'sample': 'eluer_a',
'seed': 5201314,
'gpu': true
}
r = requests.post(url, data=data)
print(r.json())
import requests
url = 'http://127.0.0.1:5699/api/word/sd'
data = {
'positive': 'masterpiece,floating hair, girl',
'negative': 'bad hands, text',
'width': 512,
'height': 512,
'step': 15,
'num': 1,
'model': 'dark_sushi_25d',
'sample': 'eluer_a',
'seed': 5201314,
'gpu': true
}
r = requests.post(url, data=data)
print(r.json())
js
let formData = new FormData();
formData.append("positive", "masterpiece,floating hair, girl");
formData.append("negative", "bad hands, text");
formData.append("width", 512);
formData.append("height", 512);
formData.append("step", 15);
formData.append("num", 1);
formData.append("model", "dark_sushi_25d");
formData.append("sample", "eluer_a");
formData.append("seed", 5201314);
formData.append("gpu", true);
fetch("http://127.0.0.1:5699/api/word/sd", {
method: "POST",
body: formData,
})
.then((response) => response.json())
.then((data) => {
console.log(data);
});
let formData = new FormData();
formData.append("positive", "masterpiece,floating hair, girl");
formData.append("negative", "bad hands, text");
formData.append("width", 512);
formData.append("height", 512);
formData.append("step", 15);
formData.append("num", 1);
formData.append("model", "dark_sushi_25d");
formData.append("sample", "eluer_a");
formData.append("seed", 5201314);
formData.append("gpu", true);
fetch("http://127.0.0.1:5699/api/word/sd", {
method: "POST",
body: formData,
})
.then((response) => response.json())
.then((data) => {
console.log(data);
});
js
curl -X POST -F 'positive=masterpiece,floating hair, girl' -F 'negative=bad hands, text' -F 'width=512' -F 'height=512' -F 'step=15' -F 'num=1' -F 'model=dark_sushi_25d' -F 'sample=eluer_a' -F 'seed=5201314' -F 'gpu=true' http://127.0.0.1:5699/api/word/sd
curl -X POST -F 'positive=masterpiece,floating hair, girl' -F 'negative=bad hands, text' -F 'width=512' -F 'height=512' -F 'step=15' -F 'num=1' -F 'model=dark_sushi_25d' -F 'sample=eluer_a' -F 'seed=5201314' -F 'gpu=true' http://127.0.0.1:5699/api/word/sd
响应结果
json
{ "status": "success", "msg": "ok" }
{ "status": "success", "msg": "ok" }
可选模型
json
[
{ "value": "absolutereality" },
{ "value": "analog" },
{ "value": "anylora" },
{ "value": "anythingv4" },
{ "value": "brav5" },
{ "value": "camelliamix_25d" },
{ "value": "cetusmix_coda2" },
{ "value": "cetusmix_v4" },
{ "value": "chikmix_v3" },
{ "value": "chilloutmix_nipruned" },
{ "value": "counterfeitv2" },
{ "value": "dark_sushi_25d" },
{ "value": "dark_sushi_brighter" },
{ "value": "dark_sushi_colorfull" },
{ "value": "dark_sushi_darker" },
{ "value": "deliberate" },
{ "value": "disney_cartoon_a" },
{ "value": "disney_cartoon_b" },
{ "value": "dreamlike_photorealv2" },
{ "value": "dreamshaper" },
{ "value": "duchaitenniji" },
{ "value": "epicrealism" },
{ "value": "fantasticmix" },
{ "value": "fxpotorealistic" },
{ "value": "ghostmixv2" },
{ "value": "guofendimension" },
{ "value": "guofeng33" },
{ "value": "guofenreal" },
{ "value": "hassanblend_v15" },
{ "value": "icbinp" },
{ "value": "majicmix-sombre-v2" },
{ "value": "majicmix_luxv2" },
{ "value": "majicmix_realistic_v6" },
{ "value": "majicmix_realisticv5" },
{ "value": "majicmixfantasy_v2" },
{ "value": "moonfilm_grain" },
{ "value": "moonfilm_reality3" },
{ "value": "moonfilmu_topia3" },
{ "value": "moyo_nature" },
{ "value": "novelai" },
{ "value": "nyan_mix" },
{ "value": "openjourney" },
{ "value": "photoreal" },
{ "value": "realisian" },
{ "value": "realistic_vision_v2" },
{ "value": "reliberate" },
{ "value": "rpg_v4" },
{ "value": "samaritan" },
{ "value": "sdv15" },
{ "value": "xxmix_9realistic" }
]
[
{ "value": "absolutereality" },
{ "value": "analog" },
{ "value": "anylora" },
{ "value": "anythingv4" },
{ "value": "brav5" },
{ "value": "camelliamix_25d" },
{ "value": "cetusmix_coda2" },
{ "value": "cetusmix_v4" },
{ "value": "chikmix_v3" },
{ "value": "chilloutmix_nipruned" },
{ "value": "counterfeitv2" },
{ "value": "dark_sushi_25d" },
{ "value": "dark_sushi_brighter" },
{ "value": "dark_sushi_colorfull" },
{ "value": "dark_sushi_darker" },
{ "value": "deliberate" },
{ "value": "disney_cartoon_a" },
{ "value": "disney_cartoon_b" },
{ "value": "dreamlike_photorealv2" },
{ "value": "dreamshaper" },
{ "value": "duchaitenniji" },
{ "value": "epicrealism" },
{ "value": "fantasticmix" },
{ "value": "fxpotorealistic" },
{ "value": "ghostmixv2" },
{ "value": "guofendimension" },
{ "value": "guofeng33" },
{ "value": "guofenreal" },
{ "value": "hassanblend_v15" },
{ "value": "icbinp" },
{ "value": "majicmix-sombre-v2" },
{ "value": "majicmix_luxv2" },
{ "value": "majicmix_realistic_v6" },
{ "value": "majicmix_realisticv5" },
{ "value": "majicmixfantasy_v2" },
{ "value": "moonfilm_grain" },
{ "value": "moonfilm_reality3" },
{ "value": "moonfilmu_topia3" },
{ "value": "moyo_nature" },
{ "value": "novelai" },
{ "value": "nyan_mix" },
{ "value": "openjourney" },
{ "value": "photoreal" },
{ "value": "realisian" },
{ "value": "realistic_vision_v2" },
{ "value": "reliberate" },
{ "value": "rpg_v4" },
{ "value": "samaritan" },
{ "value": "sdv15" },
{ "value": "xxmix_9realistic" }
]
如有新模型需求,请反馈。