make API consistent

This commit is contained in:
carl 2024-08-23 13:33:31 -03:00
parent dd7f8c14b0
commit bebe2ae18c

View File

@ -123,6 +123,11 @@ class yoloserv(object):
self.intox_detector.init() self.intox_detector.init()
# clear memory of all image data
@cherrypy.expose
def svc_init(self):
self.facematcher.init()
return '{ "status":0, "remark":"OK" }'
# Acquire image - the device used depends on the device list and what actual file was loaded as self.camera # Acquire image - the device used depends on the device list and what actual file was loaded as self.camera
# @doc acquires an image from the camera (test OK CG 2024-0724) # @doc acquires an image from the camera (test OK CG 2024-0724)
@ -167,24 +172,24 @@ class yoloserv(object):
# @doc load an image from a file using the specified yoloserv plugin (test OK CG 2024-0724) # @doc load an image from a file using the specified yoloserv plugin (test OK CG 2024-0724)
@cherrypy.expose @cherrypy.expose
def svc_load_face(self,name,infile): def svc_load_img(self,name,infile):
return self.facematcher.load1(name, self.indir + infile) return self.facematcher.load1(name, self.indir + infile)
# @doc load images from two files using the specified yoloserv plugin (test OK CG 2024-0724) # @doc load images from two files using the specified yoloserv plugin (test OK CG 2024-0724)
@cherrypy.expose @cherrypy.expose
def svc_load_faces(self,name1,infile1,name2,infile2): def svc_load_imgs(self,name1,infile1,name2,infile2):
return self.facematcher.load2(name1, self.indir + infile1, name2, self.indir + infile2) return self.facematcher.load2(name1, self.indir + infile1, name2, self.indir + infile2)
# @doc find all the faces in the named image that was loaded using the above calls (test OK CG 2024-0724) # @doc find all the faces in the named image that was loaded using the above calls (test OK CG 2024-0724)
@cherrypy.expose @cherrypy.expose
def svc_get_faces(self,which): def svc_faces(self,which):
return self.facematcher.get_faces(which) return self.facematcher.get_faces(which)
# @doc find the most prominent face in the named image that was loaded using the above calls (test OK CG 2024-0724) # @doc find the most prominent face in the named image that was loaded using the above calls (test OK CG 2024-0724)
# you can access the new ideal face (if present) with the image name "_ideal" # you can access the new ideal face (if present) with the image name "_ideal"
@cherrypy.expose @cherrypy.expose
def svc_get_ideal(self,which): def svc_ideal(self,which,rectname,cropname):
return self.facematcher.get_ideal(which) return self.facematcher.get_ideal(which,rectname,cropname)
# @doc dumps the named image as an <img> tag for straight to HTML output (test OK CG 2024-0724) # @doc dumps the named image as an <img> tag for straight to HTML output (test OK CG 2024-0724)
@cherrypy.expose @cherrypy.expose
@ -197,6 +202,14 @@ class yoloserv(object):
def svc_compare(self,name1,name2): def svc_compare(self,name1,name2):
return self.facematcher.compare(name1,name2) return self.facematcher.compare(name1,name2)
@cherrypy.expose
def svc_facematch(self,name1,infile1,name2,infile2):
self.facematcher.init()
return self.facematcher.get_faces(name1)
return self.facematcher.get_faces(name2)
self.facematcher.load2(name1, self.indir + infile1, name2, self.indir + infile2)
return self.facematcher.compare(name1,name2)
@cherrypy.expose @cherrypy.expose
def shutdown(self): def shutdown(self):