DEBUG 宽高更正

This commit is contained in:
2023-07-12 15:38:53 +08:00
parent f090ccd4d4
commit 16f98bfffb
2 changed files with 8 additions and 8 deletions

View File

@@ -154,12 +154,8 @@ func (model *Model) Inference(image_list []Image, callback func(Image)) {
datx["n_iter"] = len(image_list) // 生成图像数量
datx["steps"] = img.Steps // 迭代步数
datx["cfg_scale"] = img.CfgScale // 提示词引导系数 (CFG Scale)
if img.Width > 0 {
datx["width"] = img.Width // 图片
}
if img.Height > 0 {
datx["height"] = img.Height // 图片高度
}
datx["width"] = img.Width // 图片宽度
datx["height"] = img.Height // 图片
if img.SamplerName == "" {
datx["sampler_name"] = img.SamplerName // 采样器名称
}
@@ -186,8 +182,6 @@ func (model *Model) Inference(image_list []Image, callback func(Image)) {
image_list[index].Path = "data/images/" + filename + ".webp"
image_list[index].Hash = filename
image_list[index].Type = "image/webp"
image_list[index].Width = 512
image_list[index].Height = 512
image_list[index].Format = "webp"
image_list[index].Status = "success"
image_list[index].Progress = 100

View File

@@ -169,6 +169,12 @@ func ImagesPost(w http.ResponseWriter, r *http.Request) {
if template.CfgScale > 20 {
template.CfgScale = 20
}
if template.Width <= 0 {
template.Width = 512
}
if template.Height <= 0 {
template.Height = 512
}
if template.ModelID <= 0 {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("model_id 参数不能为空"))