from gradio import Interface, Image, Label import tensorflow as tf # Load your TensorFlow model model = tf.keras.models.load_model("a.h5") # Define your class names if needed class_names = ['Asian-Green-Bee-Eater', 'Brown-Headed-Barbet', 'Cattle-Egret', 'Common-Kingfisher', 'Common-Myna', 'House-Crow', 'Indian-Grey-Hornbill', 'Indian-Peacock', 'Indian-Roller', 'White-Breasted-Kingfisher'] # Function to make predictions def classify_image(image): # Preprocess the image img = tf.image.resize(image, (224, 224)) img = tf.expand_dims(img, 0) # Add batch dimension # Make prediction prediction = model.predict(img) predicted_class = class_names[prediction.argmax()] return predicted_class # Gradio interface image = Image() # Remove the `shape` argument label = Label() # Create interface interface = Interface(classify_image, image, label, title="Bird Species Classification", description="Upload an image of a bird to classify its species.").launch()