|
|
@ -14,6 +14,7 @@ from ultralytics.engine.results import Results |
|
|
|
class UltralyticsRequest(BaseModel): |
|
|
|
class UltralyticsRequest(BaseModel): |
|
|
|
image: str |
|
|
|
image: str |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UltralyticsResponse(BaseModel): |
|
|
|
class UltralyticsResponse(BaseModel): |
|
|
|
status: str = "success" |
|
|
|
status: str = "success" |
|
|
|
results: List[List[Dict]] |
|
|
|
results: List[List[Dict]] |
|
|
@ -24,7 +25,7 @@ class YOLOServe(ls.LitAPI): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Litserve API for YOLO model: |
|
|
|
Litserve API for YOLO model: |
|
|
|
Call order is: |
|
|
|
Call order is: |
|
|
|
setup -> batch -> decode_request -> predict -> unbatch -> encode_response |
|
|
|
setup -> batch -> decode_request -> predict -> unbatch -> encode_response. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
Args: |
|
|
|
model (str): Model name to use |
|
|
|
model (str): Model name to use |
|
|
@ -56,8 +57,6 @@ class YOLOServe(ls.LitAPI): |
|
|
|
return UltralyticsResponse(results=[r.to_dict() for r in result]) |
|
|
|
return UltralyticsResponse(results=[r.to_dict() for r in result]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(args): |
|
|
|
def run(args): |
|
|
|
if "model" in args: |
|
|
|
if "model" in args: |
|
|
|
model = args["model"] |
|
|
|
model = args["model"] |
|
|
|