Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: fix readme for pydantic v2
Signed-off-by: samsja <[email protected]>
  • Loading branch information
samsja committed Sep 29, 2023
commit 829c128afa52bf8d4170f928b5eb8d07329f16ff
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class MyDocument(BaseDoc):
image_url: ImageUrl # could also be VideoUrl, AudioUrl, etc.
image_tensor: Optional[
TorchTensor[1704, 2272, 3]
] # could also be NdArray or TensorflowTensor
embedding: Optional[TorchTensor]
] = None # could also be NdArray or TensorflowTensor
embedding: Optional[TorchTensor] = None
```

So not only can you define the types of your data, you can even **specify the shape of your tensors!**
Expand Down Expand Up @@ -643,8 +643,8 @@ import tensorflow as tf


class Podcast(BaseDoc):
audio_tensor: Optional[AudioTensorFlowTensor]
embedding: Optional[AudioTensorFlowTensor]
audio_tensor: Optional[AudioTensorFlowTensor] = None
embedding: Optional[AudioTensorFlowTensor] = None


class MyPodcastModel(tf.keras.Model):
Expand Down Expand Up @@ -713,6 +713,7 @@ async def create_item(doc: InputDoc) -> OutputDoc:
)
return doc


input_doc = InputDoc(text='', img=ImageDoc(tensor=np.random.random((3, 224, 224))))

async with AsyncClient(app=app, base_url="http://test") as ac:
Expand Down
1 change: 0 additions & 1 deletion tests/documentation/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def test_files_good(fpath):
check_md_file(fpath=fpath, memory=True, keyword_ignore=['pickle', 'jac'])


@pytest.mark.skipif(is_pydantic_v2, reason="Not working with pydantic v2 for now")
def test_readme():
check_md_file(
fpath='README.md',
Expand Down