Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
111 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from bentoml.grpc.utils import import_generated_stubs | ||
from bentoml.testing.grpc import create_channel | ||
from bentoml.testing.grpc import async_client_call | ||
|
||
if TYPE_CHECKING: | ||
from bentoml.grpc.v1alpha1 import service_pb2 as pb | ||
else: | ||
pb, _ = import_generated_stubs() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_multipart(host: str, img_file: str): | ||
with open(str(img_file), "rb") as f: | ||
fb = f.read() | ||
|
||
async with create_channel(host) as channel: | ||
await async_client_call( | ||
"predict_multi_images", | ||
channel=channel, | ||
data={ | ||
"multipart": { | ||
"fields": { | ||
"original": pb.Part( | ||
file=pb.File(kind=pb.File.FILE_TYPE_BMP, content=fb) | ||
), | ||
"compared": pb.Part( | ||
file=pb.File(kind=pb.File.FILE_TYPE_BMP, content=fb) | ||
), | ||
} | ||
} | ||
}, | ||
) | ||
await async_client_call( | ||
"ensure_metrics_are_registered", | ||
channel=channel, | ||
data={"text": "input_string"}, | ||
) |
This file contains 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
This file contains 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