SalmanAboAraj commited on
Commit
f63cd7c
·
verified ·
1 Parent(s): 919a921

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -17,13 +17,20 @@ def predict(image):
17
  mask = (mask[0] > 0.5).astype(np.uint8) * 255
18
  mask = cv2.resize(mask, (original_width, original_height))
19
  return mask
 
 
 
 
20
 
21
- iface = gr.Interface(
22
- fn=predict,
23
- inputs=gr.Image(type="numpy", label="Input X-ray Image"),
24
- outputs=gr.Image(type="numpy", label="Annotation Mask"),
25
- title="Tooth Segmentation Model",
26
- description="Upload a dental X-ray image to generate the annotation mask.", )
 
 
 
27
 
28
  if __name__ == "__main__":
29
  iface.launch(share=True)
 
17
  mask = (mask[0] > 0.5).astype(np.uint8) * 255
18
  mask = cv2.resize(mask, (original_width, original_height))
19
  return mask
20
+
21
+ with gr.Blocks() as iface:
22
+ gr.Markdown("# Tooth Segmentation Model")
23
+ gr.Markdown("Upload a dental X-ray image to generate the annotation mask.")
24
 
25
+ with gr.Row():
26
+ with gr.Column():
27
+ input_image = gr.Image(type="numpy", label="Input X-ray Image")
28
+ submit_button = gr.Button("Predict")
29
+
30
+ with gr.Column():
31
+ output_image = gr.Image(type="numpy", label="Annotation Mask")
32
+
33
+ submit_button.click(fn=predict, inputs=input_image, outputs=output_image)
34
 
35
  if __name__ == "__main__":
36
  iface.launch(share=True)