I am getting this error:
DuplicateWidgetID: There are multiple identical st.button
widgets with key='1'
.
To fix this, please make sure that the key
argument is unique for each st.button
you create.
how can I solve this
def Breccia_Predictions():
image_=pre_process()
model = tf.keras.models.load_model(model_path)
prediction_steps_per_epoch = np.math.ceil(image_.n / image_.batch_size)
image_.reset()
Breccia_predictions = model.predict_generator(image_, steps=prediction_steps_per_epoch, verbose=1)
predicted_classes = np.argmax(Breccia_predictions, axis=1)
return Predicted_classes
def main():
image_file=st.file_uploader('upload a breccia rock', type=['png', 'jpg', 'jpeg'], accept_multiple_files=True,)
if image_file is not None:
count+
for image in image_file:
file_details = {"FileName":image.name,"FileType":image.type}
st.write(file_details)
img = load_image(image)
st.image(img)
#saving file
with open(os.path.join("Breccia", image.name),"wb") as f:
f.write(image.getbuffer())
st.success("Saved File")
if(st.button('Predicted', key = count)):
predicted=Breccia_Predictions