Dokkone commited on
Commit
3963e7f
·
verified ·
1 Parent(s): c5f86e6

Update pages/model_1.py

Browse files
Files changed (1) hide show
  1. pages/model_1.py +1 -22
pages/model_1.py CHANGED
@@ -17,10 +17,6 @@ def load_model():
17
  with st.spinner('Model is being loaded..'):
18
  model = load_model()
19
 
20
- st.write("# ResNet50 Model")
21
-
22
- st.sidebar.info("You should be happy if it classifies as - Healthy plant 🙂")
23
-
24
  file = st.file_uploader("Upload the image to be classified", type=["jpg", "png"])
25
  st.set_option('deprecation.showfileUploaderEncoding', False)
26
 
@@ -40,21 +36,4 @@ def upload_predict(upload_image, model):
40
 
41
 
42
  if file is None:
43
- st.text("Please upload an image file")
44
- else:
45
- image = Image.open(file)
46
- st.image(image, use_column_width=True)
47
-
48
- prediction = upload_predict(image, model)
49
- predicted_result = np.argmax(prediction)
50
-
51
- classfiers = ['bacterial_leaf_blight','bacterial_leaf_streak','bakanae','brown_spot','grassy_stunt_virus','healthy_rice_plant',
52
- 'narrow_brown_spot','ragged_stunt_virus','rice_blast','rice_false_smut','sheath_blight','sheath_rot','stem_rot','tungro_virus']
53
- image_class = classfiers[predicted_result]
54
- confidence_score = prediction[0][predicted_result]
55
-
56
- # Results
57
- result = f"Your plant is suffering from: *{image_class}*"
58
- result_score = "✅ Accurate prediction score is: {} / 100".format("%.2f" % confidence_score)
59
- st.success(result)
60
- st.info(result_score)
 
17
  with st.spinner('Model is being loaded..'):
18
  model = load_model()
19
 
 
 
 
 
20
  file = st.file_uploader("Upload the image to be classified", type=["jpg", "png"])
21
  st.set_option('deprecation.showfileUploaderEncoding', False)
22
 
 
36
 
37
 
38
  if file is None:
39
+ st.text("Please upload an image file")