Commit 2aaad0d2 authored by Administrator's avatar Administrator

产品图抠图和重绘,先提交一次

parent 53a74aa9
......@@ -73,57 +73,6 @@ export default {
});
},
submitSDInPaint(
task_id: string = "",
img_idx: string = "",
prompt: string = "",
negative_prompt: string = "",
width: string = "",
height: string = "",
sampler_index: string = "",
seed: string = "",
steps: string = "",
cfg_scale: string = "",
encrypt: string = "false",
model: string = "",
base_img: string = "",
mask: string = ""
): Promise<{"domain_image_path": string, "local_image_path": string}> {
if (!prompt || !base_img || !mask) {
return Promise.reject("SD提示词、基础图、mask均不能为空");
}
const post_data = {
task_id: task_id,
img_idx: img_idx,
prompt: prompt,
negative_prompt: negative_prompt,
sampler_index: sampler_index,
seed: seed,
steps: steps,
width: width,
height: height,
cfg_scale: cfg_scale,
encrypt: encrypt,
model: model,
base_img: base_img,
mask: mask
}
return request.post('/text2video/img2img_inpaint', post_data)
.then((res: any) => {
// console.log(res);
if (res && res.code === 0) {
return {"domain_image_path": res.data.result.domain_image_path, "local_image_path": res.data.result.local_image_path};
} else {
const errorMessage = res ? res.message : "未知错误";
return Promise.reject(errorMessage);
}
})
.catch((err: any) => {
console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与 stable-diffusion-webui Api 通讯失败`);
});
},
submitGenVideo(gen_video_param: any): Promise<string> {
if (!gen_video_param) {
return Promise.reject("输入不能为空");
......@@ -258,4 +207,75 @@ export default {
return Promise.reject(`与ImgTextMatch Api通讯失败`);
});
},
submitCutOutImg(param: any): Promise<any> {
const post_data = param;
return request.post('/text2video/cutout_from_img', post_data)
.then((res: any) => {
// console.log(res);
if (res && res.code === 0) {
return res.data.result;
} else {
const errorMessage = res ? res.message : "未知错误";
return Promise.reject(errorMessage);
}
})
.catch((err: any) => {
console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与 cutout_from_img Api 通讯失败`);
});
},
submitSDInPaint(
task_id: string = "",
img_idx: string = "",
prompt: string = "",
negative_prompt: string = "",
width: string = "",
height: string = "",
sampler_index: string = "",
seed: string = "",
steps: string = "",
cfg_scale: string = "",
encrypt: string = "false",
model: string = "",
base_img: string = "",
mask: string = "",
img_data_type: string = ""
): Promise<{"domain_image_path": string, "local_image_path": string}> {
if (!prompt || !base_img || !mask) {
return Promise.reject("SD提示词、基础图、mask均不能为空");
}
const post_data = {
task_id: task_id,
img_idx: img_idx,
prompt: prompt,
negative_prompt: negative_prompt,
sampler_index: sampler_index,
seed: seed,
steps: steps,
width: width,
height: height,
cfg_scale: cfg_scale,
encrypt: encrypt,
model: model,
base_img: base_img,
mask: mask,
img_data_type: img_data_type
}
return request.post('/text2video/img2img_inpaint', post_data)
.then((res: any) => {
// console.log(res);
if (res && res.code === 0) {
return {"domain_image_path": res.data.result.domain_image_path, "local_image_path": res.data.result.local_image_path};
} else {
const errorMessage = res ? res.message : "未知错误";
return Promise.reject(errorMessage);
}
})
.catch((err: any) => {
console.log(`err = ${JSON.stringify(err)}`);
return Promise.reject(`与 img2img_inpaint Api 通讯失败`);
});
},
}
This diff is collapsed.
......@@ -63,4 +63,9 @@ declare namespace Wm {
],
"message": string
}
interface Coordinate {
"x": int,
"y": int,
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment