i have built a stream lit app gave the path to a trained model but when i upload an image to test im getting error as
image/jpeg files are not allowed
for any type of file i upload
please help. Here’s my code
import streamlit as st
import numpy as np
from skimage.io import imread
from skimage.transform import resize
import joblib
from PIL import Image
import streamlit.components.v1 as components
st.title('Plant Disease Identification')
st.text('Upload the image to verify')
model = joblib.load(r"C:\Users\SARATH\OneDrive\Desktop\Project\leaf disease detection")
uploaded_file = st.file_uploader("Choose Image....",type = 'jpeg')
if uploaded_file is not None:
img = Image.open(uploaded_file)
st.image(img,caption = 'Uploaded image')
if st.button('PREDICT'):
st.write('Result....')
CATEGORIES = ['Tomato___Leaf_Mold','Tomato___Late_blight','Tomato___healthy','Potato___Late_blight','Potato___healthy','Potato___Early_blight','Grape___healthy','Grape___Esca_(Black_Measles)','Grape___Black_rot','Corn_(maize)___Northern_Leaf_Blight','Corn_(maize)___healthy','Corn_(maize)___Common_rust_','Apple___healthy','Apple___Apple_scab']
flat_data = []
img = np.array(img)
img_resized = resize(img,(150,150,3))
flat_data.append(img_resized.flatten())
flat_data = np.array(flat_data)
y_out = model.predict(flat_data)
y_out = CATEGORIES[y_out[0]]
st.title(f'Predicted output:{y_out}')
q = model.predict_proba(flat_data)
for index,item in enumerate(CATEGORIES): #prints the probability of all the categories
st.write(f'{item} : {q[0][index]*100}%')