import gradio as gr import tensorflow as tf from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.image import load_img, img_to_array import numpy as np from PIL import Image model = load_model('model_extended.h5') def predict_image(image): img_array = img_to_array(image) img_array = img_array.reshape((1, 256, 256, 3)) img_array = img_array / 255.0 predictions = model.predict(img_array) predicted_class_index = predictions.argmax() class_labels = ['bacterial_leaf_blight', 'bacterial_leaf_streak', 'bacterial_panicle_blight','blast','brown_spot','dead_heart','downy_mildew','hispa','normal','tungro' ] # Replace with your actual class labels predicted_class_label = class_labels[predicted_class_index] return predicted_class_label my_app = gr.Blocks() with my_app: gr.Markdown("