feat: 植物识别

This commit is contained in:
Blizzard
2026-02-10 12:35:46 +08:00
parent e612234c91
commit 556ab6baff
24 changed files with 2745 additions and 11473 deletions
+36
View File
@@ -0,0 +1,36 @@
package plant
import (
"sundynix-go/global"
"sundynix-go/model/commom/response"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type OcrApi struct{}
// ClassifyPlant
// @tags 识别相关
// @Summary base64植物识别
// @Security ApiKeyAuth
// @accept multipart/form-data
// @Produce application/json
// @Param file formData file true "植物识别"
// @Success 200 {object} response.Response{msg=string} "文件OCR"
// @router /ocr/base64 [post]
func (o *OcrApi) ClassifyPlant(c *gin.Context) {
multipartFile, header, err := c.Request.FormFile("file")
if err != nil {
global.Logger.Error("接收文件失败!", zap.Error(err))
response.FailWithMsg("接收文件失败!", c)
return
}
res, err := ocrService.ClassifyPlant(multipartFile, header)
if err != nil {
global.Logger.Error("植物识别识别!", zap.Error(err))
response.FailWithMsg("植物识别失败!", c)
return
}
response.OkWithData(res, c)
}