File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
tests/integrations/predefined_document Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,16 @@ class VideoDoc(BaseDoc):
39
39
You can use this Document directly:
40
40
41
41
```python
42
- from docarray.documents import VideoDoc
42
+ from docarray.documents import VideoDoc, AudioDoc
43
43
44
44
# use it directly
45
45
vid = VideoDoc(
46
46
url='https://github.com/docarray/docarray/blob/main/tests/toydata/mov_bbb.mp4?raw=true'
47
47
)
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
49
52
# model = MyEmbeddingModel()
50
53
# vid.embedding = model(vid.tensor)
51
54
```
Original file line number Diff line number Diff line change 4
4
from pydantic import parse_obj_as
5
5
6
6
from docarray import BaseDoc
7
- from docarray .documents import VideoDoc
7
+ from docarray .documents import VideoDoc , AudioDoc
8
8
from docarray .typing import AudioNdArray , NdArray , VideoNdArray
9
9
from docarray .utils ._internal .misc import is_tf_available
10
10
from docarray .utils ._internal .pydantic import is_pydantic_v2
25
25
@pytest .mark .parametrize ('file_url' , [LOCAL_VIDEO_FILE , REMOTE_VIDEO_FILE ])
26
26
def test_video (file_url ):
27
27
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
29
32
30
33
assert isinstance (vid .tensor , VideoNdArray )
31
34
assert isinstance (vid .audio .tensor , AudioNdArray )
You can’t perform that action at this time.
0 commit comments