Suweeraya commited on
Commit
d2628e1
·
1 Parent(s): 14cd39c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -42,11 +42,9 @@ def build_model(input_shape):
42
  d3 = decoder_block(d2, s2, 128)
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
  def preprocess_image(image, size=128):
@@ -67,6 +65,7 @@ def segment(image):
67
  return mask_image
68
 
69
  if __name__ == "__main__":
 
70
  gr.Interface(
71
  fn=segment,
72
  inputs="image",
 
42
  d3 = decoder_block(d2, s2, 128)
43
  d4 = decoder_block(d3, s1, 64)
44
 
45
+ output_layer = Conv2D(1, 1, padding="same", activation="sigmoid")(d4)
 
 
 
46
  model = Model(input_layer, output_layer, name="U-Net")
47
+ model.load_weights('BreastCancerSegmentation.h5')
48
  return model
49
 
50
  def preprocess_image(image, size=128):
 
65
  return mask_image
66
 
67
  if __name__ == "__main__":
68
+ model = build_model(input_shape=(size, size, 1))
69
  gr.Interface(
70
  fn=segment,
71
  inputs="image",