import app as st from keras.models import load_model import numpy as np model=load_model("crop_prediction_model.h5",compile=True) labels=["Tomato Bacterial Spot","Early Blight","Healthy","Late Blight","Leaf Mold","Tomato Septoria leaf spot", "Tomato___Spider_mites Two spotted spider mite","Tomato___Target_Spot","Tomato___Tomato_mosaic_virus", "Tomato___Tomato_Yellow_Leaf_Curl_Virus"] def classify_image(img): img = img.reshape((-1, 256, 256, 3)) type=predict_crop(img) return type def predict_crop(img): crop_class=model.predict(img) index=np.argmax(crop_class) label=labels[index] return label img = st.camera_input("Take a picture") if img: class_of_plant=classify_image(img) st.write(class_of_plant) else : st.write("Image is not clear.")