Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,11 +43,13 @@ def build_model(input_shape):
|
|
43 |
d4 = decoder_block(d3, s1, 64)
|
44 |
|
45 |
output_layer = Conv2D(1, 1, padding="same", activation="sigmoid")(d4)
|
|
|
46 |
model.compile(loss="binary_crossentropy", optimizer="Adam", metrics=["accuracy"])
|
|
|
|
|
47 |
return model
|
48 |
|
49 |
-
|
50 |
-
model = build_model(input_shape=(size, size, 1))
|
51 |
|
52 |
def preprocess_image(image, size=128):
|
53 |
image = cv2.resize(image, (size, size))
|
@@ -73,4 +75,4 @@ if __name__ == "__main__":
|
|
73 |
outputs=gr.Image(type="pil", label="Breast Cancer Mask"),
|
74 |
title="Breast Cancer Ultrasound Image Segmentation",
|
75 |
description="Check out this exciting development in the field of breast cancer diagnosis and treatment! A demo of Breast Cancer Ultrasound Image Segmentation has been developed. Upload an image file, or try out one of the examples below!"
|
76 |
-
).launch(debug=True)
|
|
|
43 |
d4 = decoder_block(d3, s1, 64)
|
44 |
|
45 |
output_layer = Conv2D(1, 1, padding="same", activation="sigmoid")(d4)
|
46 |
+
model = build_model(input_shape=(size, size, 1))
|
47 |
model.compile(loss="binary_crossentropy", optimizer="Adam", metrics=["accuracy"])
|
48 |
+
model.load_weights('BreastCancerSegmentation.h5')
|
49 |
+
model = Model(input_layer, output_layer, name="U-Net")
|
50 |
return model
|
51 |
|
52 |
+
|
|
|
53 |
|
54 |
def preprocess_image(image, size=128):
|
55 |
image = cv2.resize(image, (size, size))
|
|
|
75 |
outputs=gr.Image(type="pil", label="Breast Cancer Mask"),
|
76 |
title="Breast Cancer Ultrasound Image Segmentation",
|
77 |
description="Check out this exciting development in the field of breast cancer diagnosis and treatment! A demo of Breast Cancer Ultrasound Image Segmentation has been developed. Upload an image file, or try out one of the examples below!"
|
78 |
+
).launch(debug=True)
|