def get_image_bytes_from_url()

in experiments/google/cloud/ml/applied/images/image_to_text.py [0:0]


def get_image_bytes_from_url(image_url: str) -> bytes:
    with urllib.request.urlopen(image_url) as response:
        response = typing.cast(http.client.HTTPResponse, response)
        image_bytes = response.read()
    return image_bytes