Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,24 +22,24 @@ img_width = 224
|
|
22 |
class_names = ['Palm', 'Others']
|
23 |
model = tf.keras.models.load_model('model')
|
24 |
|
|
|
|
|
25 |
with st.form("form", clear_on_submit=True):
|
26 |
uploaded_file = st.file_uploader("Upload image files", type="jpg", accept_multiple_files=True)
|
27 |
-
submitted = st.form_submit_button("
|
28 |
|
29 |
if submitted and uploaded_file is not None:
|
30 |
-
st.write("
|
31 |
st.image(uploaded_file, width=100)
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
score = predictions[0]
|
44 |
-
st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
|
45 |
|
|
|
22 |
class_names = ['Palm', 'Others']
|
23 |
model = tf.keras.models.load_model('model')
|
24 |
|
25 |
+
#Generate_pred = st.button("Generate Prediction")
|
26 |
+
|
27 |
with st.form("form", clear_on_submit=True):
|
28 |
uploaded_file = st.file_uploader("Upload image files", type="jpg", accept_multiple_files=True)
|
29 |
+
submitted = st.form_submit_button("Generate prodiction!")
|
30 |
|
31 |
if submitted and uploaded_file is not None:
|
32 |
+
st.write("Predicting!")
|
33 |
st.image(uploaded_file, width=100)
|
34 |
|
35 |
+
for file in uploaded_file:
|
36 |
+
img = Image.open(file)
|
37 |
+
img_array = img_to_array(img)
|
38 |
+
img_array = tf.expand_dims(img_array, axis = 0) # Create a batch
|
39 |
+
processed_image = preprocess_input(img_array)
|
40 |
+
|
41 |
+
predictions = model.predict(processed_image)
|
42 |
+
score = predictions[0]
|
43 |
+
st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
|
44 |
+
|
|
|
|
|
45 |
|