From 6040996147b1c705d4e1c6bf79668be70c8b3abe Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 11 Oct 2022 10:51:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=95=9C=E5=83=8F=E7=9A=84ap?= =?UTF-8?q?i=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/repo/cloudbrain.go | 22 ++++++++++++++++++++++ routers/routes/routes.go | 2 ++ 2 files changed, 24 insertions(+) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 9311ddeac..9bab29250 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -1498,6 +1498,28 @@ func GetStarImages(ctx *context.Context) { } +func GetModelArtsImages(ctx *context.Context) { + var engines modelarts.Engine + _ = json.Unmarshal([]byte(setting.Engines), &engines) + ctx.Data["engines"] = engines.Info + + var versionInfos modelarts.VersionInfo + _ = json.Unmarshal([]byte(setting.EngineVersions), &versionInfos) + ctx.JSON(http.StatusOK, versionInfos.Version) + +} + +func GetC2netNpuImages(ctx *context.Context) { + images, err := grampus.GetImages(grampus.ProcessorTypeNPU) + if err != nil { + log.Error("GetImages failed:", err.Error()) + ctx.JSON(http.StatusOK, []models.GrampusImage{}) + } else { + ctx.JSON(http.StatusOK, images.Infos) + } + +} + func getUID(ctx *context.Context) int64 { var uid int64 = -1 if ctx.IsSigned { diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 66a357c79..c51f819a2 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -353,6 +353,8 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/images/public", repo.GetPublicImages) m.Get("/images/custom", repo.GetCustomImages) m.Get("/images/star", repo.GetStarImages) + m.Get("/images/modelarts", repo.GetModelArtsImages) + m.Get("/images/c2netnpu", repo.GetC2netNpuImages) m.Get("/repos", routers.ExploreRepos) m.Get("/datasets", routers.ExploreDatasets)