MissingBreath commited on
Commit
ad60c55
·
verified ·
1 Parent(s): 1feab46

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +2 -2
api.py CHANGED
@@ -210,7 +210,7 @@ async def classify(image: UploadFile = File(...)):
210
  else:
211
  return {"error": "No image provided"}
212
 
213
- model = YOLO("yolo11m.pt")
214
  @app.post("/multiclassify")
215
  async def classify(image: UploadFile = File(...)):
216
  if image is not None:
@@ -229,7 +229,7 @@ async def classify(image: UploadFile = File(...)):
229
  cropped_image = cropped_image.resize((64,64))
230
  img_array = np.array(cropped_image) / 255.0
231
  img_array = np.expand_dims(img_array, axis=0)
232
- predictions = model.predict(img_array)
233
  predicted_class_idx = np.argmax(predictions)
234
  predicted_class_idx = int(predicted_class_idx)
235
 
 
210
  else:
211
  return {"error": "No image provided"}
212
 
213
+ yolomodel = YOLO("yolo11m.pt")
214
  @app.post("/multiclassify")
215
  async def classify(image: UploadFile = File(...)):
216
  if image is not None:
 
229
  cropped_image = cropped_image.resize((64,64))
230
  img_array = np.array(cropped_image) / 255.0
231
  img_array = np.expand_dims(img_array, axis=0)
232
+ predictions = yolomodel.predict(img_array)
233
  predicted_class_idx = np.argmax(predictions)
234
  predicted_class_idx = int(predicted_class_idx)
235