NORLIE JHON MALAGDAO commited on
Commit
7b372d6
·
verified ·
1 Parent(s): bb25d9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -89,8 +89,6 @@ plt.ylabel('Count', fontsize=14)
89
  plt.xticks(rotation=45)
90
  plt.show()
91
 
92
-
93
-
94
  # Display 16 pictures of the dataset with their labels
95
  random_index = np.random.randint(0, len(image_df), 16)
96
  fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(10, 10),
@@ -183,7 +181,7 @@ test_images = test_generator.flow_from_dataframe(
183
  dataframe=test_df,
184
  x_col='Filepath',
185
  y_col='Label',
186
- target_size=(224, 224),
187
  color_mode='rgb',
188
  class_mode='categorical',
189
  batch_size=32,
@@ -381,7 +379,7 @@ fig, axes = plt.subplots(nrows=3, ncols=5, figsize=(15, 10),
381
 
382
  for i, ax in enumerate(axes.flat):
383
  img_path = test_df.Filepath.iloc[random_index[i]]
384
- img_array = tf.keras.applications.efficientnet_v2.preprocess_input(get_img_array(img_path, size=(224, 224)))
385
  heatmap = make_gradcam_heatmap(img_array, model, last_conv_layer_name="top_conv")
386
  cam_path = save_and_display_gradcam(img_path, heatmap)
387
  ax.imshow(plt.imread(cam_path))
@@ -419,3 +417,4 @@ gr.Interface(
419
  description="The image data set used was obtained from Kaggle and has a collection of 12 different types of agricultural pests: Ants, Bees, Beetles, Caterpillars, Earthworms, Earwigs, Grasshoppers, Moths, Slugs, Snails, Wasps, and Weevils",
420
  css=custom_css
421
  ).launch(debug=True)
 
 
89
  plt.xticks(rotation=45)
90
  plt.show()
91
 
 
 
92
  # Display 16 pictures of the dataset with their labels
93
  random_index = np.random.randint(0, len(image_df), 16)
94
  fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(10, 10),
 
181
  dataframe=test_df,
182
  x_col='Filepath',
183
  y_col='Label',
184
+ target_size =(224, 224),
185
  color_mode='rgb',
186
  class_mode='categorical',
187
  batch_size=32,
 
379
 
380
  for i, ax in enumerate(axes.flat):
381
  img_path = test_df.Filepath.iloc[random_index[i]]
382
+ img_array = tf.keras.applications.efficientnet_v2.preprocess_input(get_img _array(img_path, size=(224, 224)))
383
  heatmap = make_gradcam_heatmap(img_array, model, last_conv_layer_name="top_conv")
384
  cam_path = save_and_display_gradcam(img_path, heatmap)
385
  ax.imshow(plt.imread(cam_path))
 
417
  description="The image data set used was obtained from Kaggle and has a collection of 12 different types of agricultural pests: Ants, Bees, Beetles, Caterpillars, Earthworms, Earwigs, Grasshoppers, Moths, Slugs, Snails, Wasps, and Weevils",
418
  css=custom_css
419
  ).launch(debug=True)
420
+