i am trying to drag and drop an image to predict using the following code but it is not dragging and dropping:
elif choose=='AI-Predict':
model=load_model('tuberculosis.h5')
image1_path=[('Normal_testing.png','Normal')]
image2_path=[('Normal_testing2.png','Normal')]
image3_path=[('Tuberculosis_testing.png','TB')]
image4_path=[('Tuberculosis_testing2.png','TB')]
st.title('Image Classification')
class_names=['Normal','Tuberculosis']
uploaded_file=st.file_uploader('',type=['jpg','jpeg','png'])
if st.button('Predict'):
if uploaded_file is not None:
img=load_img(uploaded_file,target_size=(128,128))
img=img_to_array(img)
img=np.expand_dims(img,axis=0)
img=img/255.0
pred=model.predict(img)
probabilities = pred[0]
class_names =['Normal','Tuberculosis']
arg = np.argmax(probabilities)
final_pred = probabilities[arg] *100
st.write(f"The model predicts with {round(final_pred,2)}% that the image belongs to class {class_names[arg]}")
col1,col2,col3,col4 = st.columns(4)
with col1:
for image,label in image1_path:
img=Image.open(image)
st.image(img,caption=label,use_column_width=True)
with col2:
for image,label in image2_path:
img=Image.open(image)
st.image(img,caption=label,use_column_width=True)
with col3:
for image,label in image3_path:
img=Image.open(image)
st.image(img,caption=label,use_column_width=True)
with col4:
for image,label in image4_path:
img=Image.open(image)
st.image(img,caption=label,use_column_width=True)