Skip to content

Commit

Permalink
do not add json if it's empty
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo committed Sep 30, 2024
1 parent 364bb5f commit d75c5f3
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/hume/expression_measurement/batch/client_with_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ def start_inference_job_from_local_file(
)
client.expression_measurement.batch.start_inference_job_from_local_file()
"""
files: typing.Dict[str, typing.Any] = {
"file": file,
}
if json is not None:
files["json"] = jsonlib.dumps(jsonable_encoder(json)).encode("utf-8")

_response = self._client_wrapper.httpx_client.request(
"v0/batch/jobs",
method="POST",
files={
"file": file,
"json": jsonlib.dumps(jsonable_encoder(json)).encode("utf-8"),
},
files=files,
request_options=request_options,
)
try:
Expand Down Expand Up @@ -192,13 +195,16 @@ async def start_inference_job_from_local_file(
)
client.expression_measurement.batch.start_inference_job_from_local_file()
"""
files: typing.Dict[str, typing.Any] = {
"file": file,
}
if json is not None:
files["json"] = jsonlib.dumps(jsonable_encoder(json)).encode("utf-8")

_response = await self._client_wrapper.httpx_client.request(
"v0/batch/jobs",
method="POST",
files={
"file": file,
"json": jsonlib.dumps(jsonable_encoder(json)).encode("utf-8"),
},
files=files,
request_options=request_options,
)
try:
Expand Down

0 comments on commit d75c5f3

Please sign in to comment.