Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/use content in examples #21

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading