updated getRunninginstances logic
Former-commit-id: 437d3a36b7ff32d08a2760cc360856f784115775
This commit is contained in:
parent
da674642ea
commit
aaf7cf3cb5
|
@ -1,28 +1,25 @@
|
||||||
package inference
|
package inference
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/tzwang/pcm-coordinator/internal/logic/inference"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||||
"gitlink.org.cn/tzwang/pcm-coordinator/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
"gitlink.org.cn/tzwang/pcm-coordinator/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetRunningInstanceByModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetRunningInstanceByModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.GetRunningInstanceReq
|
var req types.GetRunningInstanceReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
result.ParamErrorResult(r, w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := inference.NewGetRunningInstanceByModelLogic(r.Context(), svcCtx)
|
l := inference.NewGetRunningInstanceByModelLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetRunningInstanceByModel(&req)
|
resp, err := l.GetRunningInstanceByModel(&req)
|
||||||
if err != nil {
|
result.HttpResult(r, w, resp, err)
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
|
||||||
} else {
|
|
||||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ package inference
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"gitlink.org.cn/tzwang/pcm-coordinator/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
"gitlink.org.cn/tzwang/pcm-coordinator/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,7 @@ func NewGetRunningInstanceByModelLogic(ctx context.Context, svcCtx *svc.ServiceC
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *GetRunningInstanceByModelLogic) GetRunningInstanceByModel(req *types.GetRunningInstanceReq) (resp *types.GetRunningInstanceResp, err error) {
|
func (l *GetRunningInstanceByModelLogic) GetRunningInstanceByModel(req *types.GetRunningInstanceReq) (resp *types.GetRunningInstanceResp, err error) {
|
||||||
// todo: add your logic here and delete this line
|
resp = &types.GetRunningInstanceResp{}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ var (
|
||||||
"image_classification": {"imagenet_resnet50"},
|
"image_classification": {"imagenet_resnet50"},
|
||||||
"text_to_text": {"chatGLM_6B"},
|
"text_to_text": {"chatGLM_6B"},
|
||||||
"image_to_text": {"blip-image-captioning-base"},
|
"image_to_text": {"blip-image-captioning-base"},
|
||||||
|
"text_to_image": {"stable-diffusion-xl-base-1.0"},
|
||||||
}
|
}
|
||||||
AITYPE = map[string]string{
|
AITYPE = map[string]string{
|
||||||
"1": OCTOPUS,
|
"1": OCTOPUS,
|
||||||
|
|
Loading…
Reference in New Issue