Skip to content

Commit d9e8ce7

Browse files
committed
example: annotated related arg for extract_faces()
1 parent eed25ec commit d9e8ce7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/face_recognition/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ class FaceBase:
2828
MAX_IMAGE_WIDTH = 1280
2929

3030

31-
@cocoindex.op.function(cache=True, behavior_version=1, gpu=True)
31+
@cocoindex.op.function(
32+
cache=True,
33+
behavior_version=1,
34+
gpu=True,
35+
related_arg_attr=(cocoindex.op.RelatedFieldAttribute.RECTS_BASE_IMAGE, "content"),
36+
)
3237
def extract_faces(content: bytes) -> list[FaceBase]:
3338
"""Extract the first pages of a PDF."""
3439
orig_img = Image.open(io.BytesIO(content)).convert("RGB")

0 commit comments

Comments
 (0)