迭代步数
This commit is contained in:
		@@ -16,29 +16,29 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Image struct {
 | 
					type Image struct {
 | 
				
			||||||
	ID                int       `json:"id" gorm:"primary_key"` // ID
 | 
						ID             int       `json:"id" gorm:"primary_key"` // ID
 | 
				
			||||||
	Name              string    `json:"name"`                  // 名称
 | 
						Name           string    `json:"name"`                  // 名称
 | 
				
			||||||
	Hash              string    `json:"hash"`                  // 哈希值
 | 
						Hash           string    `json:"hash"`                  // 哈希值
 | 
				
			||||||
	Path              string    `json:"path"`                  // 路径
 | 
						Path           string    `json:"path"`                  // 路径
 | 
				
			||||||
	Type              string    `json:"type"`                  // 类型
 | 
						Type           string    `json:"type"`                  // 类型
 | 
				
			||||||
	Size              int       `json:"size"`                  // 大小
 | 
						Size           int       `json:"size"`                  // 大小
 | 
				
			||||||
	Width             int       `json:"width"`                 // 宽度
 | 
						Width          int       `json:"width"`                 // 宽度
 | 
				
			||||||
	Height            int       `json:"height"`                // 高度
 | 
						Height         int       `json:"height"`                // 高度
 | 
				
			||||||
	Format            string    `json:"format"`                // 格式
 | 
						Format         string    `json:"format"`                // 格式
 | 
				
			||||||
	Prompt            string    `json:"prompt"`                // 提示词
 | 
						Prompt         string    `json:"prompt"`                // 提示词
 | 
				
			||||||
	NegativePrompt    string    `json:"negative_prompt"`       // 负向提示
 | 
						NegativePrompt string    `json:"negative_prompt"`       // 负向提示
 | 
				
			||||||
	NumInferenceSteps int       `json:"num_inference_steps"`   // 推理步数(minimum: 1; maximum: 500)
 | 
						Steps          int       `json:"steps"`                 // 迭代步数 (Steps 1~150)
 | 
				
			||||||
	CfgScale          int       `json:"cfg_scale"`             // 引导比例(minimum: 1; maximum: 20)
 | 
						CfgScale       int       `json:"cfg_scale"`             // 引导比例(minimum: 1; maximum: 20)
 | 
				
			||||||
	SamplerName       string    `json:"sampler_name"`          // 采样器名称
 | 
						SamplerName    string    `json:"sampler_name"`          // 采样器名称
 | 
				
			||||||
	Seed              int       `json:"seed"`                  // 随机种子(minimum: 0; maximum: 2147483647)
 | 
						Seed           int       `json:"seed"`                  // 随机种子(minimum: 0; maximum: 2147483647)
 | 
				
			||||||
	FromImage         int       `json:"from_image"`            // 来源图片(如果是从图片生成的, 则记录来源图片的ID)
 | 
						FromImage      int       `json:"from_image"`            // 来源图片(如果是从图片生成的, 则记录来源图片的ID)
 | 
				
			||||||
	Task              string    `json:"task"`                  // 任务编号(uuid)
 | 
						Task           string    `json:"task"`                  // 任务编号(uuid)
 | 
				
			||||||
	Status            string    `json:"status"`                // 任务状态(queued|running|finished|failed)
 | 
						Status         string    `json:"status"`                // 任务状态(queued|running|finished|failed)
 | 
				
			||||||
	Progress          int       `json:"progress"`              // 任务进度(0-100)
 | 
						Progress       int       `json:"progress"`              // 任务进度(0-100)
 | 
				
			||||||
	Public            bool      `json:"public"`                // 是否公开
 | 
						Public         bool      `json:"public"`                // 是否公开
 | 
				
			||||||
	UserID            int       `json:"user_id"`               // 用户ID
 | 
						UserID         int       `json:"user_id"`               // 用户ID
 | 
				
			||||||
	CreatedAt         time.Time `json:"created_at" gorm:"autoCreateTime"`
 | 
						CreatedAt      time.Time `json:"created_at" gorm:"autoCreateTime"`
 | 
				
			||||||
	UpdatedAt         time.Time `json:"updated_at" gorm:"autoUpdateTime"`
 | 
						UpdatedAt      time.Time `json:"updated_at" gorm:"autoUpdateTime"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 将图片输出为指定尺寸的 webp 格式(默认使用 Lanczos 缩放算法)
 | 
					// 将图片输出为指定尺寸的 webp 格式(默认使用 Lanczos 缩放算法)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,7 +92,7 @@ func (model *Model) Inference(image_list []Image, callback func(Image)) {
 | 
				
			|||||||
			datx["prompt"] = img.Prompt      // 提示词
 | 
								datx["prompt"] = img.Prompt      // 提示词
 | 
				
			||||||
			datx["seed"] = img.Seed          // 随机数种子
 | 
								datx["seed"] = img.Seed          // 随机数种子
 | 
				
			||||||
			datx["n_iter"] = len(image_list) // 生成图像数量
 | 
								datx["n_iter"] = len(image_list) // 生成图像数量
 | 
				
			||||||
			datx["steps"] = 50               // 迭代步数
 | 
								datx["steps"] = img.Steps        // 迭代步数
 | 
				
			||||||
			datx["cfg_scale"] = img.CfgScale // 提示词引导系数 (CFG Scale)
 | 
								datx["cfg_scale"] = img.CfgScale // 提示词引导系数 (CFG Scale)
 | 
				
			||||||
			if img.SamplerName == "" {
 | 
								if img.SamplerName == "" {
 | 
				
			||||||
				datx["sampler_name"] = img.SamplerName // 采样器名称
 | 
									datx["sampler_name"] = img.SamplerName // 采样器名称
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -162,7 +162,7 @@ func ImagesPost(w http.ResponseWriter, r *http.Request) {
 | 
				
			|||||||
				image.FromImage = template.FromImage
 | 
									image.FromImage = template.FromImage
 | 
				
			||||||
				image.Prompt = template.Prompt
 | 
									image.Prompt = template.Prompt
 | 
				
			||||||
				image.NegativePrompt = template.NegativePrompt
 | 
									image.NegativePrompt = template.NegativePrompt
 | 
				
			||||||
				image.NumInferenceSteps = template.Steps
 | 
									image.Steps = template.Steps
 | 
				
			||||||
				image.CfgScale = template.CfgScale
 | 
									image.CfgScale = template.CfgScale
 | 
				
			||||||
				image.SamplerName = template.SamplerName
 | 
									image.SamplerName = template.SamplerName
 | 
				
			||||||
				image.Seed = template.Seed
 | 
									image.Seed = template.Seed
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user