Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,11 +88,12 @@ focal_loss = sm.losses.CategoricalFocalLoss()
|
|
| 88 |
total_loss = dice_loss + (1 * focal_loss)
|
| 89 |
|
| 90 |
# ... (previous code)
|
| 91 |
-
|
|
|
|
| 92 |
|
| 93 |
def process_input_image(image_source):
|
| 94 |
image = np.expand_dims(image_source, 0)
|
| 95 |
-
prediction = satellite_model(image)
|
| 96 |
predicted_image = np.argmax(prediction, axis=3)
|
| 97 |
predicted_image = predicted_image[0, :, :]
|
| 98 |
rgb_image = label_to_rgb(predicted_image)
|
|
@@ -101,6 +102,9 @@ def process_input_image(image_source):
|
|
| 101 |
# ... (rest of the code)
|
| 102 |
|
| 103 |
|
|
|
|
|
|
|
|
|
|
| 104 |
my_app = gr.Blocks()
|
| 105 |
|
| 106 |
# Define the custom legend HTML
|
|
|
|
| 88 |
total_loss = dice_loss + (1 * focal_loss)
|
| 89 |
|
| 90 |
# ... (previous code)
|
| 91 |
+
# ... (previous code)
|
| 92 |
+
satellite_model = tf.keras.models.load_model("satellite_segmentation_v3_full", custom_objects={'dice_loss_plus_1focal_loss': total_loss, 'jaccard_coef': jaccard_coef, 'DiceLoss': sm.losses.DiceLoss, 'CategoricalFocalLoss': sm.losses.CategoricalFocalLoss})
|
| 93 |
|
| 94 |
def process_input_image(image_source):
|
| 95 |
image = np.expand_dims(image_source, 0)
|
| 96 |
+
prediction = satellite_model.predict(image)
|
| 97 |
predicted_image = np.argmax(prediction, axis=3)
|
| 98 |
predicted_image = predicted_image[0, :, :]
|
| 99 |
rgb_image = label_to_rgb(predicted_image)
|
|
|
|
| 102 |
# ... (rest of the code)
|
| 103 |
|
| 104 |
|
| 105 |
+
# ... (rest of the code)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
my_app = gr.Blocks()
|
| 109 |
|
| 110 |
# Define the custom legend HTML
|