-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.
Description
Hi,
Google Vision python package doesn't raise exceptions for non-existent gcs uri resources, instead returns an annotation object with empty list for texts. This makes it harder to tell if the resource doesn't exist or if the vision api failed to detect any text.
- OS type and version: macOS Sierra 10.12.3
- Python version: Python 2.7.10
- google-cloud-python version: Version: 0.23.0
- Code example - relevant code snippets
from google.cloud import storage, vision
from google.cloud.storage import Blob
from google.cloud.vision.image import Feature
from google.cloud.vision.image import FeatureTypes
features = [Feature(FeatureTypes.TEXT_DETECTION)]
vision_client = vision.Client()
image = vision_client.image(source_uri="<gcs uri>")
annotations = image.detect(features)
if annotations:
annotation = annotations[0]
if annotation.texts:
text = annotation.texts[0].description
else:
text = None
print(text)
Metadata
Metadata
Assignees
Labels
api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.