pic_scanner.api package
Module contents
- pic_scanner.api.analyze_image(image_path, base_url=None, do_not_provision=False, do_not_convert=False, **kwargs)
Analyze an image using the inference server.
- Parameters:
image_path (str) – The path to the image.
base_url (Optional[str]) – The base URL of the inference server.
do_not_provision (bool)
do_not_convert (bool)
- Returns:
The result of the analysis.
- Return type:
dict
- pic_scanner.api.create_payload(image_path, do_not_expand=False, do_not_resolve=False, do_not_convert=False, do_not_provision=False)
Create a payload for the request.
- Parameters:
image_path (str) – The path to the image.
do_not_expand (bool) – A flag indicating whether to expand the path.
do_not_resolve (bool) – A flag indicating whether to resolve the path.
do_not_convert (bool) – A flag indicating whether to convert the path to a string.
do_not_provision (bool)
- Returns:
The payload for the request.
- Return type:
dict
- Raises:
ValueError – If the path is invalid.
- pic_scanner.api.make_request(image_path, base_url='http://localhost:8080/infer', do_not_expand=False, do_not_resolve=False, do_not_convert=False, do_not_provision=False)
Make a request to the inference server.
- Parameters:
image_path (Union[str, Path]) – The path to the image.
base_url (str) – The base URL of the inference server.
do_not_expand (bool) – A flag indicating whether to expand the path.
do_not_resolve (bool) – A flag indicating whether to resolve the path.
do_not_convert (bool) – A flag indicating whether to convert a string to a pathlib.Path object.
do_not_provision (bool) – A flag indicating whether to provision the path.
- Returns:
The result of the request.
- Return type:
dict
- Raises:
requests.exceptions.HTTPError – If the request was unsuccessful.
ValueError – If the path is invalid.
FileNotFoundError – If the file does not exist.
PermissionError – If the file is not accessible.
IsADirectoryError – If the path is a directory.