Classify an image from a URL or local file path. If a local folder is provided, all images in the folder will be classified.
(image_url_or_path)
| 148 | |
| 149 | |
| 150 | def classify(image_url_or_path): |
| 151 | """ Classify an image from a URL or local file path. |
| 152 | If a local folder is provided, all images in the folder |
| 153 | will be classified. """ |
| 154 | is_valid_url = web_core.is_valid_url(image_url_or_path) |
| 155 | if is_valid_url: |
| 156 | return classify_image_url(image_url_or_path) |
| 157 | elif isfile(image_url_or_path): |
| 158 | return classify_local_image(image_url_or_path) |
| 159 | elif isdir(image_url_or_path): |
| 160 | return classify_folder_images(image_url_or_path, return_dict=True) |
| 161 | else: |
| 162 | raise Exception("Expecting an image URL, file path, or folder path!") |
nothing calls this directly
no test coverage detected