取消直接训练
This commit is contained in:
		@@ -37,7 +37,7 @@ func ModelsGet(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
func ModelsPost(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	models.AccountRead(w, r, func(account *models.Account) {
 | 
			
		||||
		fmt.Println(account)
 | 
			
		||||
		// TODO: 判斷權限(是否可以創建)
 | 
			
		||||
 | 
			
		||||
		// 創建模型
 | 
			
		||||
		var model models.Model
 | 
			
		||||
		body, err := ioutil.ReadAll(r.Body)
 | 
			
		||||
@@ -52,9 +52,7 @@ func ModelsPost(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if model.Name == "" {
 | 
			
		||||
			w.WriteHeader(http.StatusBadRequest)
 | 
			
		||||
			w.Write([]byte("模型名稱不能為空"))
 | 
			
		||||
			return
 | 
			
		||||
			model.Name = utils.RandomString(8)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if model.Type == "" {
 | 
			
		||||
@@ -94,7 +92,7 @@ func ModelsPost(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 直接提交訓練任務
 | 
			
		||||
		go model.Train()
 | 
			
		||||
		// go model.Train()
 | 
			
		||||
 | 
			
		||||
		// 返回創建的模型
 | 
			
		||||
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user