Skip to content

Commit d7e3295

Browse files
committed
Merge branch 'webrtc-transport-datachannel' of https://github.com/roboflow/inference into webrtc-transport-datachannel
2 parents 98d25ed + f32024f commit d7e3295

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

inference/core/env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@
741741
)
742742
WEBRTC_MODAL_RTSP_PLACEHOLDER = os.getenv("WEBRTC_MODAL_RTSP_PLACEHOLDER")
743743
WEBRTC_MODAL_RTSP_PLACEHOLDER_URL = os.getenv("WEBRTC_MODAL_RTSP_PLACEHOLDER_URL")
744+
WEBRTC_MODAL_GCP_SECRET_NAME = os.getenv("WEBRTC_MODAL_GCP_SECRET_NAME")
744745
HTTP_API_SHARED_WORKFLOWS_THREAD_POOL_ENABLED = str2bool(
745746
os.getenv("HTTP_API_SHARED_WORKFLOWS_THREAD_POOL_ENABLED", "True")
746747
)

inference/core/interfaces/webrtc_worker/modal.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
WEBRTC_MODAL_FUNCTION_MIN_CONTAINERS,
2828
WEBRTC_MODAL_FUNCTION_SCALEDOWN_WINDOW,
2929
WEBRTC_MODAL_FUNCTION_TIME_LIMIT,
30+
WEBRTC_MODAL_GCP_SECRET_NAME,
3031
WEBRTC_MODAL_IMAGE_NAME,
3132
WEBRTC_MODAL_IMAGE_TAG,
3233
WEBRTC_MODAL_RESPONSE_TIMEOUT,
@@ -58,12 +59,19 @@
5859

5960
if modal is not None:
6061
docker_tag: str = WEBRTC_MODAL_IMAGE_TAG if WEBRTC_MODAL_IMAGE_TAG else __version__
61-
# https://modal.com/docs/reference/modal.Image
62-
video_processing_image = (
63-
modal.Image.from_registry(f"{WEBRTC_MODAL_IMAGE_NAME}:{docker_tag}")
64-
.pip_install("modal")
65-
.entrypoint([])
66-
)
62+
if WEBRTC_MODAL_GCP_SECRET_NAME:
63+
# https://modal.com/docs/reference/modal.Secret#from_name
64+
secret = modal.Secret.from_name(WEBRTC_MODAL_GCP_SECRET_NAME)
65+
# https://modal.com/docs/reference/modal.Image#from_gcp_artifact_registry
66+
video_processing_image = modal.Image.from_gcp_artifact_registry(
67+
f"{WEBRTC_MODAL_IMAGE_NAME}:{docker_tag}",
68+
secret=secret,
69+
)
70+
else:
71+
video_processing_image = modal.Image.from_registry(
72+
f"{WEBRTC_MODAL_IMAGE_NAME}:{docker_tag}"
73+
)
74+
video_processing_image = video_processing_image.pip_install("modal").entrypoint([])
6775

6876
# https://modal.com/docs/reference/modal.Volume
6977
rfcache_volume = modal.Volume.from_name("rfcache", create_if_missing=True)

0 commit comments

Comments
 (0)