lily-hust commited on
Commit
4820d53
·
1 Parent(s): 115aabe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -26,20 +26,20 @@ class_names = ['Palm', 'Others']
26
  model = tf.keras.models.load_model('model')
27
  Generate_pred = st.button("Generate Prediction")
28
 
29
- while(1):
30
- if uploaded_file is not None:
31
- if Generate_pred:
32
- for file in uploaded_file:
33
- img = Image.open(file)
34
- img_array = img_to_array(img)
35
- img_array = tf.expand_dims(img_array, axis = 0) # Create a batch
36
- processed_image = preprocess_input(img_array)
37
-
38
- predictions = model.predict(processed_image)
39
- score = predictions[0]
40
- st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
41
 
42
- if closeImage:
43
- imageContainer.empty()
44
- if uploaded_file is not None:
45
- del uploaded_file
 
26
  model = tf.keras.models.load_model('model')
27
  Generate_pred = st.button("Generate Prediction")
28
 
29
+
30
+ if uploaded_file is not None:
31
+ if Generate_pred:
32
+ for file in uploaded_file:
33
+ img = Image.open(file)
34
+ img_array = img_to_array(img)
35
+ img_array = tf.expand_dims(img_array, axis = 0) # Create a batch
36
+ processed_image = preprocess_input(img_array)
37
+
38
+ predictions = model.predict(processed_image)
39
+ score = predictions[0]
40
+ st.markdown("Predicted class of the image {} is : {}".format(file, class_names[np.argmax(score)]))
41
 
42
+ if closeImage:
43
+ imageContainer.empty()
44
+ if uploaded_file is not None:
45
+ del uploaded_file