In [7]:
def download(images):
    for i in range(len(images)):
        r = requests.get(images[i], allow_redirects=True)
        open('test_image_'+ str(i) +'.jpg', 'wb').write(r.content)

def test(image_path):
    test_image = cv2.imread(image_path)
    test_image = cv2.resize(test_image, (224, 224))

    plt.figure()
    plt.imshow(test_image)

    test_image = test_image[np.newaxis, :]
    test_image = tf.cast(test_image, tf.float32)
    predicted_value = model.predict_classes(test_image)
    plt.axis('off')
    plt.title(classes[predicted_value[0]])
In [8]:
images = ["https://images.unsplash.com/photo-1546768292-fb12f6c92568?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80",
          "https://images.unsplash.com/photo-1555041469-a586c61ea9bc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80"]
In [9]:
download(images)
In [10]:
test("test_image_0.jpg")
In [11]:
test("test_image_1.jpg")