Skip to content

图片抠图

请求地址

POST 方法:/api/image/animegan

请求参数

参数名类型必填说明
contentstring输入路径,图片或文件夹路径
modestring模式[三选一],真人、动漫、通用
max_poolint最大并发数,文件夹批处理时有效,示例:4

示例代码

python
import requests

url = 'http://127.0.0.1:5699/api/image/modnet'
data = {
    'content': '/path/to/image.jpg',
    'mode': '真人',
    'max_pool': 4
}
r = requests.post(url, data=data)
print(r.json())
import requests

url = 'http://127.0.0.1:5699/api/image/modnet'
data = {
    'content': '/path/to/image.jpg',
    'mode': '真人',
    'max_pool': 4
}
r = requests.post(url, data=data)
print(r.json())
bash
let formData = new FormData();
formData.append("content", "/path/to/image.jpg");
formData.append("mode", "真人");
formData.append("max_pool", 4);

fetch("http://127.0.0.1:5699/api/image/modnet", {
  method: "POST",
  body: formData,
})
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  });
let formData = new FormData();
formData.append("content", "/path/to/image.jpg");
formData.append("mode", "真人");
formData.append("max_pool", 4);

fetch("http://127.0.0.1:5699/api/image/modnet", {
  method: "POST",
  body: formData,
})
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  });
js
curl -X POST -F 'content=@/path/to/image.jpg' -F 'mode=真人' -F 'max_pool=4' http://127.0.0.1:5699/api/image/modnet
curl -X POST -F 'content=@/path/to/image.jpg' -F 'mode=真人' -F 'max_pool=4' http://127.0.0.1:5699/api/image/modnet

响应结果

json
{ "status": "success", "msg": "ok" }
{ "status": "success", "msg": "ok" }

Powered by 小白兔AI