Initial commit
Browse files- .gitattributes +1 -0
- app.py +31 -0
- model2.keras +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
model2.keras filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import keras
|
3 |
+
from tensorflow.keras.models import load_model # type: ignore
|
4 |
+
import streamlit as st
|
5 |
+
import tensorflow as tf
|
6 |
+
import numpy as np
|
7 |
+
|
8 |
+
st.header('Dental Classification CNN Model')
|
9 |
+
#class_names = ['daisy', 'dandelion', 'rose', 'sunflower', 'tulip']
|
10 |
+
class_names = ['Calculus', 'Dental Caries', 'Gingivitis', 'Hypodontia', 'Tooth discoloration']
|
11 |
+
|
12 |
+
model = load_model('model2.keras')
|
13 |
+
|
14 |
+
def classify_images(image_path):
|
15 |
+
input_image = tf.keras.utils.load_img(image_path, target_size=(256,256))
|
16 |
+
input_image_array = tf.keras.utils.img_to_array(input_image)
|
17 |
+
input_image_exp_dim = tf.expand_dims(input_image_array,0)
|
18 |
+
|
19 |
+
predictions = model.predict(input_image_exp_dim)
|
20 |
+
result = tf.nn.softmax(predictions[0])
|
21 |
+
outcome = 'The Image belongs to ' + class_names[np.argmax(result)] + ' with a score of '+ str(np.max(result)*100)
|
22 |
+
return outcome
|
23 |
+
|
24 |
+
uploaded_file = st.file_uploader('Upload an Image')
|
25 |
+
if uploaded_file is not None:
|
26 |
+
with open(os.path.join('upload', uploaded_file.name), 'wb') as f:
|
27 |
+
f.write(uploaded_file.getbuffer())
|
28 |
+
|
29 |
+
st.image(uploaded_file, width = 200)
|
30 |
+
|
31 |
+
st.markdown(classify_images(uploaded_file))
|
model2.keras
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ecc1ed3cbe12c5ad66f892f301100e2264bb767cbb9394f4803182cdc91c7c70
|
3 |
+
size 32383065
|