In [47]:
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Rembrandt_van_Rijn_-_Self-Portrait_-_Google_Art_Project.jpg/926px-Rembrandt_van_Rijn_-_Self-Portrait_-_Google_Art_Project.jpg"
path = tf.keras.utils.get_file('Rembrandt van Rijn - Self-Portrait - Google Art Project.jpg', origin=url)

img = keras.preprocessing.image.load_img(
    path, target_size=(img_height, img_width)
)
img_array = keras.preprocessing.image.img_to_array(img)
img_array = tf.expand_dims(img_array, 0) # Create a batch

predictions = model.predict(img_array)
score = tf.nn.softmax(predictions[0])

print(
    "This image most likely belongs to {} with a {:.2f} percent confidence."
    .format(class_names[np.argmax(score)], 100 * np.max(score))
)
This image most likely belongs to Rembrandt with a 97.46 percent confidence.
In [51]:
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8e/Van_Gogh_self-portrait_dedicated_to_Gauguin.jpg/1280px-Van_Gogh_self-portrait_dedicated_to_Gauguin.jpg"
path = tf.keras.utils.get_file('Van Gogh self-portrait dedicated to Gauguin.jpg', origin=url)

img = keras.preprocessing.image.load_img(
    path, target_size=(img_height, img_width)
)
img_array = keras.preprocessing.image.img_to_array(img)
img_array = tf.expand_dims(img_array, 0) # Create a batch

predictions = model.predict(img_array)
score = tf.nn.softmax(predictions[0])

print(
    "This image most likely belongs to {} with a {:.2f} percent confidence."
    .format(class_names[np.argmax(score)], 100 * np.max(score))
)
Downloading data from https://upload.wikimedia.org/wikipedia/commons/thumb/8/8e/Van_Gogh_self-portrait_dedicated_to_Gauguin.jpg/1280px-Van_Gogh_self-portrait_dedicated_to_Gauguin.jpg
581632/578473 [==============================] - 0s 0us/step
This image most likely belongs to Vincent_van_Gogh with a 100.00 percent confidence.