Skip to content

Commit

Permalink
Merge pull request #798 from roboflow/fix/use_base64_payloads_for_rem…
Browse files Browse the repository at this point in the history
…ote_invocations

Adjust Roboflow models to primarily use `base64` payloads
  • Loading branch information
PawelPeczek-Roboflow authored Nov 14, 2024
2 parents 4b6c7b6 + 25fbbc5 commit 61693a2
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def run_remotely(
tasks = [
partial(
client.clip_compare,
subject=single_image.numpy_image,
subject=single_image.base64_image,
prompt=classes,
clip_version=version,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def run_remotely(
max_concurrent_requests=WORKFLOWS_REMOTE_EXECUTION_MAX_STEP_CONCURRENT_REQUESTS,
)
client.configure(configuration)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.ocr_image(
inference_input=non_empty_inference_images,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def run_remotely(
client.configure(inference_configuration=configuration)
if WORKFLOWS_REMOTE_API_TARGET == "hosted":
client.select_api_v0()
inference_images = [i.to_inference_format(numpy_preferred=True) for i in images]
inference_images = [i.to_inference_format() for i in images]
image_sub_batches = list(
make_batches(
iterable=inference_images,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
inference_images = [i.numpy_image for i in images]
inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
inference_images = [i.numpy_image for i in images]
inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=non_empty_inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=non_empty_inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=non_empty_inference_images,
model_id=model_id,
Expand Down
2 changes: 1 addition & 1 deletion inference/core/workflows/execution_engine/entities/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def base64_image(self) -> str:
return self._base64_image
numpy_image = self.numpy_image
self._base64_image = base64.b64encode(
encode_image_to_jpeg_bytes(numpy_image)
encode_image_to_jpeg_bytes(numpy_image, jpeg_quality=95)
).decode("ascii")
return self._base64_image

Expand Down

0 comments on commit 61693a2

Please sign in to comment.