Python SDK reference
Everything the scripts use, plus the options they don't show.
The client
from centific import PhysicalAI
client = PhysicalAI(api_key="sk-cen-...", base_url="https://humanoidiq-dev.centific.com")
| Argument |
What it is |
api_key |
Your key (sk-cen-...). Required. |
base_url |
The server. For this beta: https://humanoidiq-dev.centific.com |
timeout |
Seconds to wait for each API call. Default 60.0. Uploads have their own, longer limit. |
client.qc
| Call |
Returns |
What it does |
create(dataset, data_type, task, wait=False) |
Job, or the report if wait=True |
Upload and start grading |
upload(dataset, data_type, task) |
Upload |
Upload only. Nothing is graded. |
grade(upload_id, wait=False) |
Job, or the report if wait=True |
Start grading an earlier upload |
get(job_id) |
Job |
Look up any of your jobs by id |
list(limit=20) |
list of Job |
Your recent jobs, newest first |
Optional arguments
| Argument |
On |
What it does |
metadata={"batch": "7"} |
create, upload, grade |
Your own labels, returned to you on the job (up to 32 keys). They don't affect grading. |
return_annotations=True |
create, grade |
Adds links to the dense annotations on the finished job |
progress=False |
create, upload |
Hides the upload progress bar |
progress=lambda sent, total: ... |
create, upload |
Your own progress handler instead of the built-in bar |
poll_seconds=60 |
create, grade |
How often wait=True checks |
Job
| Property / method |
What it gives you |
job.id |
The job id (the same as the upload id) |
job.status |
One of the statuses |
job.reason |
Why it failed or was cancelled (empty otherwise) |
job.verdict |
VERIFIED / REJECTED once complete, otherwise None |
job.done |
True once complete, failed or cancelled |
job.refresh() |
Re-reads the latest status from the server |
job.wait(poll_seconds=60, timeout_seconds=None) |
Waits until finished and returns the report. Raises QCError if the job ends failed or cancelled. |
job.report() |
The report (job must be complete) |
job.save_pdf("report.pdf") |
Saves the PDF report, and returns its path |
job.report_pdf() |
The PDF as bytes, if you'd rather handle the file yourself |
job.token() |
A browser access token, and the page to paste it on |
job.cancel() |
Cancels it, if grading hasn't started |
Upload
Returned by client.qc.upload(...).
| Property / method |
What it gives you |
up.id |
The id. It becomes the job id when you grade it. |
up.status |
uploaded |
up.filename |
The zip's file name |
up.grade() |
Same as client.qc.grade(up.id) |
Errors
Everything the SDK refuses raises centific.QCError. It carries .job_id and
.reason, so your code can react to the cause:
from centific import QCError
try:
report = job.wait()
except QCError as err:
print("no report:", err.reason) # e.g. 'unreadable_archive'
The reasons are listed in Troubleshooting.