def __init__()

in notebooks/src/code/inference.py [0:0]


    def __init__(self, spec: dict):
        if "URI" in spec:
            if not spec["URI"].lower().startswith("s3://"):
                raise ValueError("URI must be a valid 's3://...' URI if provided")
            bucket, _, key = spec["URI"][len("s3://") :].partition("/")
        else:
            bucket = spec.get("Bucket")
            key = spec.get("Key")
        if not (bucket and key and isinstance(bucket, str) and isinstance(key, str)):
            raise ValueError(
                "Must provide an object with either 'URI' or 'Bucket' and 'Key' properties. "
                f"Parsed bucket={bucket}, key={key}"
            )
        self.bucket = bucket
        self.key = key