FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: adding field descriptions to predefined audio document by punndcoder28 · Pull Request #1774 · docarray/docarray · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
30 changes: 25 additions & 5 deletions docarray/documents/audio.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import numpy as np

from pydantic import Field

from docarray.base_doc import BaseDoc
from docarray.typing import AnyEmbedding, AudioUrl
from docarray.typing.bytes.audio_bytes import AudioBytes
Expand Down Expand Up @@ -94,11 +96,29 @@ class MultiModalDoc(BaseDoc):
```
"""

url: Optional[AudioUrl] = None
tensor: Optional[AudioTensor] = None
embedding: Optional[AnyEmbedding] = None
bytes_: Optional[AudioBytes] = None
frame_rate: Optional[int] = None
url: Optional[AudioUrl] = Field(
description='The url to a (potentially remote) audio file that can be loaded',
example='https://github.com/docarray/docarray/blob/main/tests/toydata/hello.mp3?raw=true',
default=None,
)
tensor: Optional[AudioTensor] = Field(
Comment thread
punndcoder28 marked this conversation as resolved.
description='Tensor object of the audio which can be specified to one of `AudioNdArray`, `AudioTorchTensor`, `AudioTensorFlowTensor`',
default=None,
)
embedding: Optional[AnyEmbedding] = Field(
description='Store an embedding: a vector representation of the audio.',
example=[0, 1, 0],
default=None,
)
bytes_: Optional[AudioBytes] = Field(
Comment thread
punndcoder28 marked this conversation as resolved.
description='Bytes representation pf the audio',
default=None,
)
frame_rate: Optional[int] = Field(
description='An integer representing the frame rate of the audio.',
example=24,
default=None,
)

@classmethod
def validate(
Expand Down

Back | FazBrowse Home | New Git URL