Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
|
|
|
| 91 |
|
| 92 |
def process_input_image(image_source):
|
| 93 |
image = np.expand_dims(image_source, 0)
|
| 94 |
-
prediction = satellite_model
|
| 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
|