Skip to content

Commit

Permalink
Merge pull request #21 from openearthplatforminitiative/fix/use-conte…
Browse files Browse the repository at this point in the history
…nt-in-examples

Fix/use content in examples
  • Loading branch information
giltinde authored Jul 3, 2024
2 parents 4c3a92c + 2438143 commit 7e8f499
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
6 changes: 5 additions & 1 deletion crop_health_api/example_code/python/predictions__binary.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
8 changes: 4 additions & 4 deletions deployment/kubernetes/crop-health-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ 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:
name: openepi-apps-config
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
Expand All @@ -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:
Expand Down

0 comments on commit 7e8f499

Please sign in to comment.