import tensorflow as tf
from tensorflow.keras.applications import ResNet50
from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions
from tensorflow.keras.preprocessing import image
import numpy as np
def process_image(image_path):
# Load the pre-trained model
model = ResNet50(weights='imagenet')
# Load and preprocess the image
img = image.load_img(image_path, target_size=(224, 224))
img_array = image.img_to_array(img)
img_array = np.expand_dims(img_array, axis=0)
img_array = preprocess_input(img_array)
# Predict
predictions = model.predict(img_array)
description = decode_predictions(predictions, top=1)[0][0][1]
return description
aW1wb3J0IHRlbnNvcmZsb3cgYXMgdGYKZnJvbSB0ZW5zb3JmbG93LmtlcmFzLmFwcGxpY2F0aW9ucyBpbXBvcnQgUmVzTmV0NTAKZnJvbSB0ZW5zb3JmbG93LmtlcmFzLmFwcGxpY2F0aW9ucy5yZXNuZXQ1MCBpbXBvcnQgcHJlcHJvY2Vzc19pbnB1dCwgZGVjb2RlX3ByZWRpY3Rpb25zCmZyb20gdGVuc29yZmxvdy5rZXJhcy5wcmVwcm9jZXNzaW5nIGltcG9ydCBpbWFnZQppbXBvcnQgbnVtcHkgYXMgbnAKCmRlZiBwcm9jZXNzX2ltYWdlKGltYWdlX3BhdGgpOgogICAgIyBMb2FkIHRoZSBwcmUtdHJhaW5lZCBtb2RlbAogICAgbW9kZWwgPSBSZXNOZXQ1MCh3ZWlnaHRzPSdpbWFnZW5ldCcpCgogICAgIyBMb2FkIGFuZCBwcmVwcm9jZXNzIHRoZSBpbWFnZQogICAgaW1nID0gaW1hZ2UubG9hZF9pbWcoaW1hZ2VfcGF0aCwgdGFyZ2V0X3NpemU9KDIyNCwgMjI0KSkKICAgIGltZ19hcnJheSA9IGltYWdlLmltZ190b19hcnJheShpbWcpCiAgICBpbWdfYXJyYXkgPSBucC5leHBhbmRfZGltcyhpbWdfYXJyYXksIGF4aXM9MCkKICAgIGltZ19hcnJheSA9IHByZXByb2Nlc3NfaW5wdXQoaW1nX2FycmF5KQoKICAgICMgUHJlZGljdAogICAgcHJlZGljdGlvbnMgPSBtb2RlbC5wcmVkaWN0KGltZ19hcnJheSkKICAgIGRlc2NyaXB0aW9uID0gZGVjb2RlX3ByZWRpY3Rpb25zKHByZWRpY3Rpb25zLCB0b3A9MSlbMF1bMF1bMV0KCiAgICByZXR1cm4gZGVzY3JpcHRpb24K