ErnestBeckham commited on
Commit
6af4f23
·
verified ·
1 Parent(s): 29dd870
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -60,17 +60,19 @@ def main():
60
  image_class = predict_single_image(image, model, hp)
61
  #gradCam.save_and_display_gradcam()
62
  st.write(f"Image Class: {image_class}")
 
 
63
  explanation = explainer.explain_instance(
64
  gray_img.astype('double'),
65
  model.predict,
66
- top_labels=4,
67
  hide_color=0,
68
- num_samples=500
69
  )
70
  temp, mask = explanation.get_image_and_mask(
71
  explanation.top_labels[0],
72
  positive_only=True,
73
- num_features=4,
74
  hide_rest=True
75
  )
76
 
@@ -80,7 +82,7 @@ def main():
80
  # Save and display LIME explanation
81
  lime_explanation_path = 'lime_explanation.png'
82
  cv2.imwrite(lime_explanation_path, (xai * 255).astype(np.uint8))
83
- st.image(lime_explanation_path, caption="LIME Explanation", use_column_width=True)
84
 
85
 
86
  def convert_to_opencv(uploaded_file):
 
60
  image_class = predict_single_image(image, model, hp)
61
  #gradCam.save_and_display_gradcam()
62
  st.write(f"Image Class: {image_class}")
63
+
64
+
65
  explanation = explainer.explain_instance(
66
  gray_img.astype('double'),
67
  model.predict,
68
+ top_labels=2,
69
  hide_color=0,
70
+ num_samples=100
71
  )
72
  temp, mask = explanation.get_image_and_mask(
73
  explanation.top_labels[0],
74
  positive_only=True,
75
+ num_features=5,
76
  hide_rest=True
77
  )
78
 
 
82
  # Save and display LIME explanation
83
  lime_explanation_path = 'lime_explanation.png'
84
  cv2.imwrite(lime_explanation_path, (xai * 255).astype(np.uint8))
85
+ st.image((xai * 255).astype(np.uint8), caption="LIME Explanation", use_column_width=True)
86
 
87
 
88
  def convert_to_opencv(uploaded_file):