diff --git a/crop_health_api/example_code/python/predictions__binary.py b/crop_health_api/example_code/python/predictions__binary.py index a06b66e..08fb1ef 100644 --- a/crop_health_api/example_code/python/predictions__binary.py +++ b/crop_health_api/example_code/python/predictions__binary.py @@ -1,11 +1,15 @@ from httpx import Client +# Open the image file as a binary file +with open("cocoa.jpg", "rb") as image_file: + image_bytes = image_file.read() + with Client() as client: # Get the binary model prediction for image cocoa.jpg # passed as a binary file in the request body response_binary = client.post( url="$api_url" + "/predictions/binary", - data=open("cocoa.jpg", "rb").read(), + content=image_bytes, ) data_binary = response_binary.json() diff --git a/crop_health_api/example_code/python/predictions__multi-HLT.py b/crop_health_api/example_code/python/predictions__multi-HLT.py index 65c62dd..1b38281 100644 --- a/crop_health_api/example_code/python/predictions__multi-HLT.py +++ b/crop_health_api/example_code/python/predictions__multi-HLT.py @@ -1,11 +1,15 @@ from httpx import Client +# Open the image file as a binary file +with open("cocoa.jpg", "rb") as image_file: + image_bytes = image_file.read() + with Client() as client: # Get the multi-HLT model prediction for image cocoa.jpg # passed as a binary file in the request body response_multi_HLT = client.post( url="$api_url" + "/predictions/multi-HLT", - data=open("cocoa.jpg", "rb").read(), + content=image_bytes, ) data_multi_HLT = response_multi_HLT.json() diff --git a/crop_health_api/example_code/python/predictions__single-HLT.py b/crop_health_api/example_code/python/predictions__single-HLT.py index 85e2db0..a191396 100644 --- a/crop_health_api/example_code/python/predictions__single-HLT.py +++ b/crop_health_api/example_code/python/predictions__single-HLT.py @@ -1,11 +1,15 @@ from httpx import Client +# Open the image file as a binary file +with open("cocoa.jpg", "rb") as image_file: + image_bytes = image_file.read() + with Client() as client: # Get the single-HLT model prediction for image cocoa.jpg # passed as a binary file in the request body response_single_HLT = client.post( url="$api_url" + "/predictions/single-HLT", - data=open("cocoa.jpg", "rb").read(), + content=image_bytes, ) data_single_HLT = response_single_HLT.json() diff --git a/deployment/kubernetes/crop-health-api.yaml b/deployment/kubernetes/crop-health-api.yaml index d1bf0e2..675462f 100644 --- a/deployment/kubernetes/crop-health-api.yaml +++ b/deployment/kubernetes/crop-health-api.yaml @@ -19,14 +19,14 @@ spec: spec: containers: - name: crop-health-fastapi - image: ghcr.io/openearthplatforminitiative/crop-health-api-fastapi:0.1.8 + image: ghcr.io/openearthplatforminitiative/crop-health-api-fastapi:0.1.9 ports: - containerPort: 5000 env: - name: API_ROOT_PATH value: "/crop-health" - name: VERSION - value: 0.1.8 + value: 0.1.9 - name: API_DOMAIN valueFrom: configMapKeyRef: @@ -34,7 +34,7 @@ spec: key: api_domain - name: crop-health-torchserve - image: ghcr.io/openearthplatforminitiative/crop-health-api-torchserve:0.1.8 + image: ghcr.io/openearthplatforminitiative/crop-health-api-torchserve:0.1.9 ports: - containerPort: 8080 # Inference API - containerPort: 8081 # Management API @@ -43,7 +43,7 @@ spec: - name: API_ROOT_PATH value: "/crop-health" - name: VERSION - value: 0.1.8 + value: 0.1.9 - name: API_DOMAIN valueFrom: configMapKeyRef: