This repository was archived by the owner on Sep 9, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
tests/integrations/predefined_document Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,13 +39,16 @@ class VideoDoc(BaseDoc):
3939 You can use this Document directly:
4040
4141 ```python
42- from docarray.documents import VideoDoc
42+ from docarray.documents import VideoDoc, AudioDoc
4343
4444 # use it directly
4545 vid = VideoDoc(
4646 url='https://github.com/docarray/docarray/blob/main/tests/toydata/mov_bbb.mp4?raw=true'
4747 )
48- vid.tensor, vid.audio.tensor, vid.key_frame_indices = vid.url.load()
48+ tensor, audio_tensor, key_frame_indices = vid.url.load()
49+ vid.tensor = tensor
50+ vid.audio = AudioDoc(tensor=audio_tensor)
51+ vid.key_frame_indices = key_frame_indices
4952 # model = MyEmbeddingModel()
5053 # vid.embedding = model(vid.tensor)
5154 ```
Original file line number Diff line number Diff line change 44from pydantic import parse_obj_as
55
66from docarray import BaseDoc
7- from docarray .documents import VideoDoc
7+ from docarray .documents import VideoDoc , AudioDoc
88from docarray .typing import AudioNdArray , NdArray , VideoNdArray
99from docarray .utils ._internal .misc import is_tf_available
1010from docarray .utils ._internal .pydantic import is_pydantic_v2
2525@pytest .mark .parametrize ('file_url' , [LOCAL_VIDEO_FILE , REMOTE_VIDEO_FILE ])
2626def test_video (file_url ):
2727 vid = VideoDoc (url = file_url )
28- vid .tensor , vid .audio .tensor , vid .key_frame_indices = vid .url .load ()
28+ tensor , audio_tensor , key_frame_indices = vid .url .load ()
29+ vid .tensor = tensor
30+ vid .audio = AudioDoc (tensor = audio_tensor )
31+ vid .key_frame_indices = key_frame_indices
2932
3033 assert isinstance (vid .tensor , VideoNdArray )
3134 assert isinstance (vid .audio .tensor , AudioNdArray )
You can’t perform that action at this time.
0 commit comments