File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -268,12 +268,12 @@ def main():
268
268
logger .debug ("Calling method with args: %s" , args )
269
269
del vars (args )["method" ]
270
270
if hasattr (args , "files" ):
271
- file_extension = os .path .splitext (args .input )[1 ]
271
+ file_extension = os .path .splitext (args .files )[1 ]
272
272
args .files = UploadedFile (
273
- "input " ,
273
+ "files " ,
274
274
args .files ,
275
275
"application/octet-stream" ,
276
- f"input { file_extension } " ,
276
+ f"files { file_extension } " ,
277
277
)
278
278
results = method_function (** vars (args ))
279
279
print (json .dumps (results ))
@@ -322,7 +322,7 @@ def main():
322
322
--data /srv/football-players-detection-7/data.yaml\
323
323
--Enable_MLFLOW --epochs 50
324
324
325
- python3 api/__init__.py predict --input \
325
+ python3 api/__init__.py predict --files \
326
326
/srv/yolov8_api/tests/data/det/test/cat1.jpg\
327
327
--task_type det --accept application/json
328
328
"""
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ class Meta:
97
97
"description" : "image size as scalar or (h, w) list,"
98
98
" i.e. (640, 480)"
99
99
},
100
+ load_default = [640 ,480 ]
100
101
)
101
102
102
103
conf = fields .Float (
@@ -153,7 +154,8 @@ class Meta:
153
154
"description" : "Return format for method response." ,
154
155
"location" : "headers" ,
155
156
},
156
- required = True ,
157
+ required = False ,
158
+ load_default = "application/json" ,
157
159
validate = validate .OneOf (responses .content_types ),
158
160
)
159
161
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def predict(
47
47
print ("arg of prediction are" , args )
48
48
49
49
model = YOLO (args ["model" ])
50
- test_image_path = args ["input " ]
50
+ test_image_path = args ["files " ]
51
51
results = []
52
52
for image_path in test_image_path :
53
53
print (
@@ -57,7 +57,7 @@ def predict(
57
57
utils .remove_keys_from_dict (
58
58
args ,
59
59
[
60
- "input " ,
60
+ "files " ,
61
61
"accept" ,
62
62
"task_type" ,
63
63
],
@@ -73,7 +73,7 @@ def predict(
73
73
74
74
if __name__ == "__main__" :
75
75
args = {
76
- "input " : ["/home/se1131/cat1.jpg" ],
76
+ "files " : ["/home/se1131/cat1.jpg" ],
77
77
"model" : "yolov8n.pt" ,
78
78
"imgsz" : [680 , 512 ],
79
79
"conf" : 0.25 ,
You can’t perform that action at this time.
0 commit comments