How can I replace this function if I want to read the data from a Google Cloud Storage bucket (as opposed to local storage) and put it in an array like in this function?
def load_data(img_dir):
return np.array(
[cv2.imread(os.path.join(img_dir, img), 0).flatten() for img in os.listdir(img_dir) if img.endswith(".jpg")])