like images
This commit is contained in:
		@@ -38,6 +38,7 @@ type Image struct {
 | 
			
		||||
	Public         bool      `json:"public"`                // 是否公开
 | 
			
		||||
	UserID         int       `json:"user_id"`               // 用户ID
 | 
			
		||||
	ModelID        int       `json:"model_id"`              // 模型ID
 | 
			
		||||
	Preview        string    `json:"preview" gorm:"-"`      // 实时预览 base64
 | 
			
		||||
	CreatedAt      time.Time `json:"created_at" gorm:"autoCreateTime"`
 | 
			
		||||
	UpdatedAt      time.Time `json:"updated_at" gorm:"autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -176,11 +176,14 @@ func (model *Model) Inference(image_list []Image, callback func(Image)) {
 | 
			
		||||
		image_list[index].Format = "webp"
 | 
			
		||||
		image_list[index].Status = "success"
 | 
			
		||||
		image_list[index].Progress = 100
 | 
			
		||||
		//image_list[index].Preview = img
 | 
			
		||||
		callback(image_list[index])
 | 
			
		||||
	}
 | 
			
		||||
	log.Println("推理完成:", model.ID, model.Name)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 加入推理任务
 | 
			
		||||
 | 
			
		||||
// 将base64编码的图片保存到本地webp
 | 
			
		||||
func SaveBase64Image(base64Str string, filename string) error {
 | 
			
		||||
	// 解码base64图片
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user