sampler_name

This commit is contained in:
2023-06-23 03:10:09 +08:00
parent ec33c9fafd
commit 0be4a4bff6
2 changed files with 1 additions and 23 deletions

View File

@@ -41,29 +41,6 @@ type Image struct {
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"` UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
} }
//// 参数校验
//func (img *Image) ParameterCheck() (err error) {
// if img.NumInferenceSteps <= 0 {
// img.NumInferenceSteps = 20
// }
// if img.NumInferenceSteps > 500 {
// img.NumInferenceSteps = 500
// }
// if img.GuidanceScale <= 0 {
// img.GuidanceScale = 1
// }
// if img.GuidanceScale > 20 {
// img.GuidanceScale = 20
// }
// if img.Scheduler == "" {
// img.Scheduler = "DDIM"
// }
// if img.Seed == "" {
// img.Seed = "0"
// }
// return
//}
// 将图片输出为指定尺寸的 webp 格式(默认使用 Lanczos 缩放算法) // 将图片输出为指定尺寸的 webp 格式(默认使用 Lanczos 缩放算法)
func (img *Image) ToWebP(width int, height int, fit string) ([]byte, error) { func (img *Image) ToWebP(width int, height int, fit string) ([]byte, error) {
// 從絕對路徑讀原始圖片 // 從絕對路徑讀原始圖片

View File

@@ -29,6 +29,7 @@ func ParamsModelsGet(w http.ResponseWriter, r *http.Request) {
params["status"] = []string{"pending", "running", "finished", "failed"} params["status"] = []string{"pending", "running", "finished", "failed"}
params["base_model"] = []string{"SD1.5", "SD2"} params["base_model"] = []string{"SD1.5", "SD2"}
params["size"] = []string{"512x512", "768x768", "1024x768"} params["size"] = []string{"512x512", "768x768", "1024x768"}
params["sampler_name"] = []string{"Euler a", "Euler", "LMS", "Heun", "DPM2", "DPM2 a", "DPM++ 2S a", "DPM++ 2M", "DPM++ SDE", "DPM++ 2M SDE", "DPM fast", "DDIM"}
w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Write(utils.ToJSON(params)) w.Write(utils.ToJSON(params))
} }