diff --git a/backend/video_capture.py b/backend/video_capture.py index 234575f310fe111415d92fc086f0af3546535387..8a9e78763a0542f0aea4b1721c576ce2aaac8e3c 100644 --- a/backend/video_capture.py +++ b/backend/video_capture.py @@ -18,6 +18,7 @@ host = os.getenv('MODEL_HOST') port = os.getenv('MODEL_PORT') model = os.getenv('MODEL_NAME') + def make_prediction(instances): url = f"http://{host}:{port}/v1/models/{model}:predict" data = json.dumps({"signature_name": "serving_default", "instances": instances.tolist()}) @@ -25,10 +26,11 @@ def make_prediction(instances): json_response = requests.post(url, data=data, headers=headers) try: predictions = json.loads(json_response.text)['predictions'] - except: + except BaseException: print("prediction failed") return predictions + async def handle_cameras(): db = SessionLocal()