superb-ai-curate
is the Python client for interacting with Superb Curate.
You don't need this source code unless you want to modify the package. If you just want to use the package, just run:
$ pip install --upgrade superb-ai-curate
Python 3.7+
You can also find the documentation for superb-ai-curate
on the website.
An Access Key is required to use the python client. This can be generated from the Settings > Access menu on the Superb AI Curate website. For more details on access key issuance and management, you can check the Access Key Management documentation. The Team Name refers to the organization name that your personal account belongs to.
import spb_curate
from spb_curate import curate
spb_curate.access_key = "..."
spb_curate.team_name = "..."
dataset = curate.fetch_dataset(id="...")
images = [
curate.Image(
key="<unique image key>",
source=curate.ImageSourceLocal(asset="/path/to/image"),
metadata={"weather": "clear", "timeofday": "daytime"},
),
curate.Image(
key="<unique image key>",
source=curate.ImageSourceLocal(asset="/path/to/image"),
metadata={"weather": "clear", "timeofday": "daytime"},
),
]
job: curate.Job = dataset.add_images(images=images)
job.wait_until_complete()
For use with multiple credentials, the requests can be configured at the function level.
from spb_curate import curate
dataset = curate.fetch_dataset(access_key="...", team_name="...", id="...")
If required, the client can be configured to produce basic logging output. There are two levels that are logged to, INFO
and DEBUG
. For production use, INFO
is the recommended logging level, however DEBUG
can be used for more verbosity.
There are several methods for setting the log level.
- Environment variable
$ export SPB_LOG_LEVEL = "INFO"
- Superb AI Curate Python client global setting
import spb_curate
spb_curate.log_level = "INFO"
- Python logging library
import logging
logging.basicConfig()
logging.getLogger("superb-ai").setLevel(logging.INFO)
The development environment relies on Poetry for package management, testing and building.
$ poetry install -E dev
$ poetry run pytest --cov=spb_curate tests