訓練進度測試
This commit is contained in:
@@ -17,8 +17,10 @@ type Model struct {
|
||||
Progress int `json:"progress"` // (0-100)
|
||||
Image string `json:"image"` // 封面圖片實際地址
|
||||
Hash string `json:"hash"` // 模型哈希值
|
||||
Tags string `json:"tags"`
|
||||
Epochs int `json:"epochs"` // 訓練步數
|
||||
Tags TagList `json:"tags"`
|
||||
UserID int `json:"user_id"`
|
||||
DatasetID int `json:"dataset_id"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"main/configs"
|
||||
"time"
|
||||
)
|
||||
@@ -15,3 +17,13 @@ type Tag struct {
|
||||
func init() {
|
||||
configs.ORMDB().AutoMigrate(&Tag{})
|
||||
}
|
||||
|
||||
type TagList []string
|
||||
|
||||
func (list *TagList) Scan(value interface{}) error {
|
||||
return json.Unmarshal(value.([]byte), list)
|
||||
}
|
||||
|
||||
func (list TagList) Value() (driver.Value, error) {
|
||||
return json.Marshal(list)
|
||||
}
|
||||
|
Reference in New Issue
Block a user