Chancee12 commited on
Commit
083cfec
·
1 Parent(s): be1518e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -87,16 +87,20 @@ dice_loss = sm.losses.DiceLoss(class_weights = weights)
87
  focal_loss = sm.losses.CategoricalFocalLoss()
88
  total_loss = dice_loss + (1 * focal_loss)
89
 
90
- satellite_model = tf.keras.models.load_model("satellite_segmentation_v3_full", custom_objects=({'dice_loss_plus_1focal_loss': total_loss, 'jaccard_coef': jaccard_coef}))
 
91
 
92
  def process_input_image(image_source):
93
  image = np.expand_dims(image_source, 0)
94
- prediction = satellite_model.predict(image)
95
  predicted_image = np.argmax(prediction, axis=3)
96
  predicted_image = predicted_image[0, :, :]
97
  rgb_image = label_to_rgb(predicted_image)
98
  return "Predicted Masked Image", rgb_image
99
 
 
 
 
100
  my_app = gr.Blocks()
101
 
102
  # Define the custom legend HTML
 
87
  focal_loss = sm.losses.CategoricalFocalLoss()
88
  total_loss = dice_loss + (1 * focal_loss)
89
 
90
+ # ... (previous code)
91
+ satellite_model = tf.saved_model.load("satellite_segmentation_v3_full")
92
 
93
  def process_input_image(image_source):
94
  image = np.expand_dims(image_source, 0)
95
+ prediction = satellite_model(image) # Change this line
96
  predicted_image = np.argmax(prediction, axis=3)
97
  predicted_image = predicted_image[0, :, :]
98
  rgb_image = label_to_rgb(predicted_image)
99
  return "Predicted Masked Image", rgb_image
100
 
101
+ # ... (rest of the code)
102
+
103
+
104
  my_app = gr.Blocks()
105
 
106
  # Define the custom legend HTML