Skip to content

Commit

Permalink
chore(tests): truncate images when logging inputs `:)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Dec 10, 2022
1 parent b099f7c commit 5c7c2f6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,22 @@ def runTest(name, banana, extraCallInputs, extraModelInputs):
inputs.get("modelInputs").update(extraModelInputs)

print("Running test: " + name)
print(json.dumps(inputs, indent=4))

inputs_to_log = {
"modelInputs": inputs["modelInputs"].copy(),
"callInputs": inputs["callInputs"].copy(),
}
model_inputs_to_log = inputs_to_log["modelInputs"]

for key in ["init_image", "image"]:
if key in model_inputs_to_log:
model_inputs_to_log[key] = "[image]"

instance_images = model_inputs_to_log.get("instance_images", None)
if instance_images:
model_inputs_to_log["instance_images"] = f"[Array({len(instance_images)})]"

print(json.dumps(inputs_to_log, indent=4))
print()

start = time.time()
Expand Down

0 comments on commit 5c7c2f6

Please sign in to comment.