Spaces:
Sleeping
Sleeping
Arslan7788
commited on
Commit
•
5c7a6df
1
Parent(s):
3ac9231
Update app.py
Browse files
app.py
CHANGED
@@ -5,18 +5,19 @@ from PIL import Image
|
|
5 |
import numpy as np
|
6 |
import cv2
|
7 |
from huggingface_hub import from_pretrained_keras
|
|
|
|
|
8 |
try:
|
9 |
model=from_pretrained_keras("SerdarHelli/Segmentation-of-Teeth-in-Panoramic-X-ray-Image-Using-U-Net")
|
10 |
except:
|
11 |
model=tf.keras.models.load_model("dental_xray_seg.h5")
|
12 |
pass
|
13 |
-
|
14 |
-
|
15 |
-
examples=["107.png"]
|
16 |
def load_image(image_file):
|
17 |
img = Image.open(image_file)
|
18 |
return img
|
19 |
-
|
20 |
def convert_one_channel(img):
|
21 |
#some images have 3 channels , although they are grayscale image
|
22 |
if len(img.shape)>2:
|
@@ -32,14 +33,28 @@ def convert_rgb(img):
|
|
32 |
return img
|
33 |
else:
|
34 |
return img
|
35 |
-
|
|
|
|
|
36 |
image_file = st.file_uploader("Upload Images", type=["png","jpg","jpeg"])
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
st.image(ex,width=200)
|
39 |
if st.button('Example 1'):
|
40 |
-
image_file=examples[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
if image_file is not None:
|
|
|
42 |
img=load_image(image_file)
|
|
|
43 |
st.text("Making A Prediction ....")
|
44 |
st.image(img,width=850)
|
45 |
|
@@ -67,4 +82,4 @@ if image_file is not None:
|
|
67 |
st.write(output.shape)
|
68 |
st.image(output,width=850)
|
69 |
|
70 |
-
st.text("DONE
|
|
|
5 |
import numpy as np
|
6 |
import cv2
|
7 |
from huggingface_hub import from_pretrained_keras
|
8 |
+
|
9 |
+
|
10 |
try:
|
11 |
model=from_pretrained_keras("SerdarHelli/Segmentation-of-Teeth-in-Panoramic-X-ray-Image-Using-U-Net")
|
12 |
except:
|
13 |
model=tf.keras.models.load_model("dental_xray_seg.h5")
|
14 |
pass
|
15 |
+
|
16 |
+
st.header(" Teeth segmentation in X-ray Image Using Machine learing")
|
17 |
+
examples=["107.png","108.png"]
|
18 |
def load_image(image_file):
|
19 |
img = Image.open(image_file)
|
20 |
return img
|
|
|
21 |
def convert_one_channel(img):
|
22 |
#some images have 3 channels , although they are grayscale image
|
23 |
if len(img.shape)>2:
|
|
|
33 |
return img
|
34 |
else:
|
35 |
return img
|
36 |
+
|
37 |
+
|
38 |
+
st.subheader("Upload Dental X-ray Image Image")
|
39 |
image_file = st.file_uploader("Upload Images", type=["png","jpg","jpeg"])
|
40 |
+
|
41 |
+
|
42 |
+
col1, col2 = st.columns(2)
|
43 |
+
with col1:
|
44 |
+
ex=load_image(examples[0])
|
45 |
st.image(ex,width=200)
|
46 |
if st.button('Example 1'):
|
47 |
+
image_file=examples[0]
|
48 |
+
|
49 |
+
with col2:
|
50 |
+
ex1=load_image(examples[1])
|
51 |
+
st.image(ex1,width=200)
|
52 |
+
if st.button('Example 2'):
|
53 |
+
image_file=examples[1]
|
54 |
if image_file is not None:
|
55 |
+
|
56 |
img=load_image(image_file)
|
57 |
+
|
58 |
st.text("Making A Prediction ....")
|
59 |
st.image(img,width=850)
|
60 |
|
|
|
82 |
st.write(output.shape)
|
83 |
st.image(output,width=850)
|
84 |
|
85 |
+
st.text("DONE")
|