Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import segmentation_models as sm
|
|
| 6 |
from matplotlib import pyplot as plt
|
| 7 |
import random
|
| 8 |
|
|
|
|
| 9 |
from keras import backend as K
|
| 10 |
from keras.models import load_model
|
| 11 |
|
|
@@ -23,8 +24,7 @@ dice_loss = sm.losses.DiceLoss(class_weights = weights)
|
|
| 23 |
focal_loss = sm.losses.CategoricalFocalLoss()
|
| 24 |
total_loss = dice_loss + (1 * focal_loss)
|
| 25 |
|
| 26 |
-
satellite_model = load_model('C:/Users/sa/Desktop/Model_Training/satellite_segmentation_full.h5',
|
| 27 |
-
custom_objects=({'dice_loss_plus_1focal_loss': total_loss,
|
| 28 |
'jaccard_coef': jaccard_coef}))
|
| 29 |
|
| 30 |
def process_input_image(image_source):
|
|
@@ -42,7 +42,7 @@ my_app = gr.Blocks()
|
|
| 42 |
with my_app:
|
| 43 |
gr.Markdown("Statellite Image Segmentation Application UI with Gradio")
|
| 44 |
with gr.Tabs():
|
| 45 |
-
with gr.TabItem ("Select your image"):
|
| 46 |
with gr.Row():
|
| 47 |
with gr.Column():
|
| 48 |
img_source = gr.Image(label="Please select source Image", shape=(256, 256))
|
|
|
|
| 6 |
from matplotlib import pyplot as plt
|
| 7 |
import random
|
| 8 |
|
| 9 |
+
|
| 10 |
from keras import backend as K
|
| 11 |
from keras.models import load_model
|
| 12 |
|
|
|
|
| 24 |
focal_loss = sm.losses.CategoricalFocalLoss()
|
| 25 |
total_loss = dice_loss + (1 * focal_loss)
|
| 26 |
|
| 27 |
+
satellite_model = load_model('C:/Users/sa/Desktop/Model_Training/satellite_segmentation_full.h5',custom_objects=({'dice_loss_plus_1focal_loss': total_loss,|
|
|
|
|
| 28 |
'jaccard_coef': jaccard_coef}))
|
| 29 |
|
| 30 |
def process_input_image(image_source):
|
|
|
|
| 42 |
with my_app:
|
| 43 |
gr.Markdown("Statellite Image Segmentation Application UI with Gradio")
|
| 44 |
with gr.Tabs():
|
| 45 |
+
with gr.TabItem ("Select your image"):
|
| 46 |
with gr.Row():
|
| 47 |
with gr.Column():
|
| 48 |
img_source = gr.Image(label="Please select source Image", shape=(256, 256))
|