Scripts¶
Each script does one thing and stands on its own: copy it, save it, run it.
How to use a script¶
- Copy the script into a new file and save it with the name shown above it, for
example
create_job.py. Your project folder is fine. - Edit the lines marked
# <- change this, if there are any. Only the upload scripts have them: your zip, its data type, and the task sentence. -
Run it from a terminal where the SDK is installed (Install) and your key is loaded (API key):
Scripts that work on an existing job take the job id after the file name:
All scripts¶
| Script | What it does | Run it as |
|---|---|---|
| Create a job | Upload, grade, wait, save the PDF, all in one go | python create_job.py |
| Upload only | Send a zip without grading it yet | python upload_only.py |
| Grade an upload | Start grading an earlier upload | python grade_job.py <job id> |
| Check status | See where a job is, once | python check_status.py <job id> |
| Wait until finished | Follow a job until it ends | python wait_for_job.py <job id> |
| Get the report & PDF | Print the results and save the PDF | python get_report.py <job id> |
| Share in a browser | A token to open the report in a browser | python report_access.py <job id> |
| Cancel a job | Stop a job before grading starts | python cancel_job.py <job id> |
| List your jobs | Your recent jobs, newest first | python list_jobs.py |
A typical session¶
If you stop it while it waits (Ctrl+C), pick the job up later:
The four lines every script starts with¶
import os
from centific import PhysicalAI
client = PhysicalAI(
api_key = os.environ["CENTIFIC_API_KEY"], # loaded from your terminal
base_url = "https://humanoidiq-dev.centific.com", # the beta server
)
Copying a script from the dashboard's API tab? Make two changes
base_url: the samples show the final release address,https://api.centific.ai. For this beta, change it tohttps://humanoidiq-dev.centific.com.api_key: right after you create a key, the samples contain your real key. Keep that file private, or better, replace it withos.environ["CENTIFIC_API_KEY"]as above. At other times the sample shows the text"$CENTIFIC_API_KEY". Python does not read that as your key, so replace it the same way.
About the sample outputs
Each script page shows the format the script prints. Ids, sizes, times, verdicts and scores are examples; yours will differ.