Skip to content

Commit 9dde9f2

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Make POST request to publish ground truths
1 parent 9fd0d2e commit 9dde9f2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

openlayer/__init__.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,5 +2125,21 @@ def publish_ground_truths(
21252125
f" `{inference_id_column_name}`. \n"
21262126
) from None
21272127

2128-
# TODO: Make POST request to publish ground truths
2129-
print("Publishing ground truths...")
2128+
with tempfile.TemporaryDirectory() as tmp_dir:
2129+
# Copy save files to tmp dir
2130+
df.to_csv(f"{tmp_dir}/dataset.csv", index=False)
2131+
payload = {
2132+
"performGroundTruthMerge": True,
2133+
"groundTruthColumnName": ground_truth_column_name,
2134+
"inferenceIdColumnName": inference_id_column_name,
2135+
}
2136+
2137+
self.api.upload(
2138+
endpoint=f"inference-pipelines/{inference_pipeline_id}/data",
2139+
file_path=f"{tmp_dir}/dataset.csv",
2140+
object_name="dataset.csv",
2141+
body=payload,
2142+
storage_uri_key="storageUri",
2143+
method="POST",
2144+
)
2145+
print("Ground truths published!")

0 commit comments

Comments
 (0)