mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
These changes allow to configure the computer vision models through an optional vision.yml configuration file. Note that the API endpoints are not yet functional and require further work. Signed-off-by: Michael Mayer <michael@photoprism.app>
36 lines
881 B
Go
36 lines
881 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/photoprism/photoprism/internal/ai/vision"
|
|
"github.com/photoprism/photoprism/internal/auth/acl"
|
|
"github.com/photoprism/photoprism/pkg/rnd"
|
|
)
|
|
|
|
// PostVisionLabels returns suitable labels for an image.
|
|
//
|
|
// @Summary returns suitable labels for an image
|
|
// @Id PostVisionLabels
|
|
// @Tags Vision
|
|
// @Produce json
|
|
// @Success 200 {object} vision.LabelsResponse
|
|
// @Failure 401,403,429 {object} i18n.Response
|
|
// @Router /api/v1/vision/labels [post]
|
|
func PostVisionLabels(router *gin.RouterGroup) {
|
|
router.POST("/vision/labels", func(c *gin.Context) {
|
|
s := Auth(c, acl.ResourceVision, acl.AccessAll)
|
|
|
|
// Abort if permission is not granted.
|
|
if s.Abort(c) {
|
|
return
|
|
}
|
|
|
|
response := vision.NewLabelsResponse(rnd.UUID(), vision.NasnetModel, nil)
|
|
|
|
c.JSON(http.StatusOK, response)
|
|
})
|
|
}
|