diff --git a/src/_bentoml_impl/client/http.py b/src/_bentoml_impl/client/http.py index 678eee03e62..e265b97f028 100644 --- a/src/_bentoml_impl/client/http.py +++ b/src/_bentoml_impl/client/http.py @@ -42,6 +42,10 @@ MAX_RETRIES = 3 +def is_http_url(url: str) -> bool: + return urlparse(url).scheme in {"http", "https"} + + @attr.define class HTTPClient(AbstractClient, t.Generic[C]): client_cls: t.ClassVar[type[BaseClient]] @@ -257,6 +261,8 @@ def is_file_field(k: str) -> bool: value = [value] for v in value: + if isinstance(v, str) and not is_http_url(v): + v = pathlib.Path(v) if is_image_type(type(v)): files.append( (