From 2c63d4d1cbe0fc6ae22fd314a75bbcb57a4caed6 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 13 Sep 2022 10:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/aisafety.go | 18 ++-- templates/repo/cloudbrain/benchmark/new.tmpl | 127 ++++++++++++++++++++++++++- 2 files changed, 135 insertions(+), 10 deletions(-) diff --git a/routers/repo/aisafety.go b/routers/repo/aisafety.go index 29e518b3c..cda85480a 100644 --- a/routers/repo/aisafety.go +++ b/routers/repo/aisafety.go @@ -5,22 +5,22 @@ import ( "io/ioutil" "net/http" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/aisafety" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" ) func CloudBrainAiSafetyCreate(ctx *context.Context) { - jobType := ctx.Query("jobType") - if jobType == string(models.JobTypeBenchmark) { - jsonMap, err := getJsonContent("http://192.168.207.34:8065/Test_zap1234/openi_aisafety/src/branch/master/result/0301.json") - if err == nil { - aisafety.GetAlgorithmList() - aisafety.CreateSafetyTask("test", jsonMap) - //aisafety.GetTaskStatus() - } + log.Info("start to create CloudBrainAiSafetyCreate") + //jobType := ctx.Query("jobType") + //if jobType == string(models.JobTypeBenchmark) { + jsonMap, err := getJsonContent("http://192.168.207.34:8065/Test_zap1234/openi_aisafety/src/branch/master/result/0301.json") + if err == nil { + aisafety.GetAlgorithmList() + aisafety.CreateSafetyTask("test", jsonMap) + //aisafety.GetTaskStatus() } + //} } func getJsonContent(url string) (map[string]interface{}, error) { diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl index 58f471ede..2dc4d1811 100755 --- a/templates/repo/cloudbrain/benchmark/new.tmpl +++ b/templates/repo/cloudbrain/benchmark/new.tmpl @@ -50,6 +50,8 @@ href="{{.Link}}?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}} {{.i18n.Tr "repo.cloudbrain.benchmark.model"}} + 模型安全评测
@@ -143,7 +145,7 @@
- {{else}} + {{else if eq .benchmarkMode "alogrithm"}}
{{.CsrfTokenHtml}} @@ -155,6 +157,8 @@ href="{{.Link}}?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}} {{.i18n.Tr "repo.cloudbrain.benchmark.model"}} + 模型安全评测 @@ -261,6 +265,127 @@
+ {{else if eq .benchmarkMode "aisafety"}} +
+ {{.CsrfTokenHtml}} + + + + +
+
+ + {{template "custom/task_wait_count" .}} +
+
+ + + {{.i18n.Tr "repo.cloudbrain_jobname_err"}} +
+
+ + +
+ + +
  +
+ + + +
+
+ + + +
+
+
+
+ + + +
+ + +
+ +
+ + + {{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}} +
+ +
+ + + {{.i18n.Tr "cloudbrain.view_sample"}} +
+ + +
+ + + {{.i18n.Tr "repo.cloudbrain.cancel"}} +
+
+
+ {{end}}