Update api.py
Browse files
api.py
CHANGED
@@ -91,10 +91,8 @@ for model_path in models_paths:
|
|
91 |
model = tf.saved_model.load(model_path)
|
92 |
models.append(model)
|
93 |
|
94 |
-
class PredictionResponse(BaseModel):
|
95 |
-
ODIR-B-2K-5Class-LastTrain-Xception: dict
|
96 |
|
97 |
-
@app.post("/predict"
|
98 |
async def predict_endpoint(file: UploadFile = File(...)):
|
99 |
|
100 |
contents = await file.read()
|
@@ -108,7 +106,4 @@ async def predict_endpoint(file: UploadFile = File(...)):
|
|
108 |
prediction = predict(image, model, filters[i])
|
109 |
result_json[models_names[i]] = result(prediction)
|
110 |
|
111 |
-
return result_json
|
112 |
-
|
113 |
-
if __name__ == "__main__":
|
114 |
-
uvicorn.run(app, host="localhost", port=8000)
|
|
|
91 |
model = tf.saved_model.load(model_path)
|
92 |
models.append(model)
|
93 |
|
|
|
|
|
94 |
|
95 |
+
@app.post("/predict")
|
96 |
async def predict_endpoint(file: UploadFile = File(...)):
|
97 |
|
98 |
contents = await file.read()
|
|
|
106 |
prediction = predict(image, model, filters[i])
|
107 |
result_json[models_names[i]] = result(prediction)
|
108 |
|
109 |
+
return result_json
|
|
|
|
|
|