|
|
|
@@ -1,30 +1,61 @@ |
|
|
|
package repo |
|
|
|
|
|
|
|
import ( |
|
|
|
"net/http" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
routerRepo "code.gitea.io/gitea/routers/repo" |
|
|
|
) |
|
|
|
|
|
|
|
func CreateNewModel(ctx *context.APIContext) { |
|
|
|
log.Info("create new model by api.") |
|
|
|
ctx.Context.SetParams("JobId", ctx.Query("jobId")) |
|
|
|
ctx.Context.SetParams("VersionName", ctx.Query("versionName")) |
|
|
|
ctx.Context.SetParams("Name", ctx.Query("name")) |
|
|
|
ctx.Context.SetParams("Version", ctx.Query("version")) |
|
|
|
ctx.Context.SetParams("Engine", ctx.Query("engine")) |
|
|
|
ctx.Context.SetParams("modelSelectedFile", ctx.Query("modelSelectedFile")) |
|
|
|
ctx.Context.SetParams("Label", ctx.Query("label")) |
|
|
|
ctx.Context.SetParams("Description", ctx.Query("description")) |
|
|
|
|
|
|
|
log.Info("CreateNewModel by api.") |
|
|
|
routerRepo.SaveModel(ctx.Context) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func ShowModelManageApi(ctx *context.APIContext) { |
|
|
|
log.Info("ShowModelManageApi by api.") |
|
|
|
routerRepo.ShowModelPageInfo(ctx.Context) |
|
|
|
} |
|
|
|
|
|
|
|
func DeleteModel(ctx *context.APIContext) { |
|
|
|
log.Info("DeleteModel by api.") |
|
|
|
routerRepo.DeleteModel(ctx.Context) |
|
|
|
} |
|
|
|
|
|
|
|
func DownloadModel(ctx *context.APIContext) { |
|
|
|
log.Info("DownloadModel by api.") |
|
|
|
routerRepo.DownloadMultiModelFile(ctx.Context) |
|
|
|
} |
|
|
|
|
|
|
|
func QueryModelListForPredict(ctx *context.APIContext) { |
|
|
|
log.Info("QueryModelListForPredict by api.") |
|
|
|
routerRepo.QueryModelListForPredict(ctx.Context) |
|
|
|
} |
|
|
|
|
|
|
|
func QueryModelFileForPredict(ctx *context.APIContext) { |
|
|
|
log.Info("QueryModelFileForPredict by api.") |
|
|
|
routerRepo.QueryModelFileForPredict(ctx.Context) |
|
|
|
} |
|
|
|
|
|
|
|
func CreateModelConvert(ctx *context.APIContext) { |
|
|
|
log.Info("CreateModelConvert by api.") |
|
|
|
routerRepo.SaveModelConvert(ctx.Context) |
|
|
|
} |
|
|
|
|
|
|
|
func ShowModelConvertPage(ctx *context.APIContext) { |
|
|
|
log.Info("ShowModelConvertPage by api.") |
|
|
|
modelResult, count, err := routerRepo.GetModelConvertPageData(ctx.Context) |
|
|
|
if err == nil { |
|
|
|
mapInterface := make(map[string]interface{}) |
|
|
|
mapInterface["data"] = modelResult |
|
|
|
mapInterface["count"] = count |
|
|
|
ctx.JSON(http.StatusOK, mapInterface) |
|
|
|
} else { |
|
|
|
mapInterface := make(map[string]interface{}) |
|
|
|
mapInterface["data"] = nil |
|
|
|
mapInterface["count"] = 0 |
|
|
|
ctx.JSON(http.StatusOK, mapInterface) |
|
|
|
} |
|
|
|
|
|
|
|
} |