diff --git a/clarifai/runners/models/model_builder.py b/clarifai/runners/models/model_builder.py index 8bffea8e..e278d153 100644 --- a/clarifai/runners/models/model_builder.py +++ b/clarifai/runners/models/model_builder.py @@ -47,9 +47,10 @@ from clarifai.versions import get_latest_version_from_pypi CLARIFAI_LATEST_VERSION = get_latest_version_from_pypi() +CLARIFAI_PROTOCOL_LATEST_VERSION = get_latest_version_from_pypi('clarifai-protocol') # Additional package installation if the model will be used w/ a streaming video runner: -# Dockerfile: Install ffmpeg and av +# Dockerfile: Install ffmpeg and clarifai-protocol[auto-annotation]. # # Our base images are distroless, so we do not have apt-get or other package managers # available; however, we will also not be able to use those package repositories on-prem. @@ -58,11 +59,11 @@ # # TODO: before we make this public, we need to figure out how to distribute the src; # line to copy in src commented out because it's 500MB -STREAMING_VIDEO_ADDITIONAL_PACKAGE_INSTALLATION = """ +STREAMING_VIDEO_ADDITIONAL_PACKAGE_INSTALLATION = f""" COPY --from=public.ecr.aws/clarifai-models/static-streaming:5.1.8 /ffmpeg /usr/local/bin/ COPY --from=public.ecr.aws/clarifai-models/static-streaming:5.1.8 /ffprobe /usr/local/bin/ # COPY --from=public.ecr.aws/clarifai-models/static-streaming:5.1.8 /src /usr/local/src/ -RUN uv pip install --no-cache-dir av +RUN uv pip install 'clarifai-protocol[auto-annotation]=={CLARIFAI_PROTOCOL_LATEST_VERSION}' """ diff --git a/clarifai/versions.py b/clarifai/versions.py index ff8f74a7..6d2abe02 100644 --- a/clarifai/versions.py +++ b/clarifai/versions.py @@ -10,7 +10,7 @@ ) -def get_latest_version_from_pypi(): +def get_latest_version_from_pypi(package: str = 'clarifai'): """ Fetch the latest version of the clarifai package from PyPI. @@ -24,7 +24,7 @@ def get_latest_version_from_pypi(): try: import requests - response = requests.get("https://pypi.org/pypi/clarifai/json", timeout=5) + response = requests.get(f"https://pypi.org/pypi/{package}/json", timeout=5) if response.status_code == 200: return response.json().get("info", {}).get("version") return None