lily-hust commited on
Commit
85a12e8
·
1 Parent(s): cab46ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -27,17 +27,17 @@ with st.form("list", clear_on_submit=True):
27
  uploaded_file = st.file_uploader("Upload image files", type="jpg", accept_multiple_files=True)
28
  submitted = st.form_submit_button("clear")
29
  st.image(uploaded_file, width=100)
30
-
31
  if uploaded_file is not None:
32
  Generate_pred = st.button("Generate Prediction")
33
- if Generate_pred:
34
- for file in uploaded_file:
35
- img = Image.open(file)
36
- img_array = img_to_array(img)
37
- img_array = tf.expand_dims(img_array, axis = 0) # Create a batch
38
- processed_image = preprocess_input(img_array)
39
-
40
- predictions = model.predict(processed_image)
41
- score = predictions[0]
42
- st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
43
 
 
27
  uploaded_file = st.file_uploader("Upload image files", type="jpg", accept_multiple_files=True)
28
  submitted = st.form_submit_button("clear")
29
  st.image(uploaded_file, width=100)
30
+
31
  if uploaded_file is not None:
32
  Generate_pred = st.button("Generate Prediction")
33
+ if Generate_pred:
34
+ for file in uploaded_file:
35
+ img = Image.open(file)
36
+ img_array = img_to_array(img)
37
+ img_array = tf.expand_dims(img_array, axis = 0) # Create a batch
38
+ processed_image = preprocess_input(img_array)
39
+
40
+ predictions = model.predict(processed_image)
41
+ score = predictions[0]
42
+ st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
43