OmarEllethy commited on
Commit
c4c28ed
1 Parent(s): f85afb1

Upload 5 files

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. Dentella.ipynb +0 -0
  3. app.py +51 -0
  4. gitattributes +36 -0
  5. imageclassifier .h5 +3 -0
  6. requirements.txt +3 -0
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ imageclassifier[[:space:]].h5 filter=lfs diff=lfs merge=lfs -text
Dentella.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, jsonify
2
+ import tensorflow as tf
3
+ import numpy as np
4
+ from PIL import Image
5
+ import io
6
+
7
+ # Initialize Flask application
8
+ app = Flask(__name__)
9
+
10
+ # Load the pre-trained TensorFlow model
11
+ model = tf.keras.models.load_model("imageclassifier.h5")
12
+
13
+ # Define the function to predict the teeth health
14
+ def predict_teeth_health(image):
15
+ # Convert the PIL image object to a file-like object
16
+ image_bytes = io.BytesIO()
17
+ image.save(image_bytes, format="JPEG")
18
+
19
+ # Load the image from the file-like object
20
+ image = tf.keras.preprocessing.image.load_img(image_bytes, target_size=(256, 256))
21
+ image = tf.keras.preprocessing.image.img_to_array(image)
22
+ image = np.expand_dims(image, axis=0)
23
+
24
+ # Make a prediction
25
+ prediction = model.predict(image)
26
+
27
+ # Get the probability of being 'Good'
28
+ probability_good = prediction[0][0] # Assuming it's a binary classification
29
+
30
+ # Define the prediction result
31
+ result = {
32
+ "prediction": "Your Teeth are Good & You Don't Need To Visit Doctor" if probability_good > 0.5 else "Your Teeth are Bad & You Need To Visit Doctor"
33
+ }
34
+
35
+ return result
36
+
37
+ # Define route to accept image and return prediction
38
+ @app.route('/predict', methods=['POST'])
39
+ def predict():
40
+ # Ensure an image was properly uploaded to our endpoint
41
+ if request.method == 'POST':
42
+ file = request.files['image']
43
+ if file:
44
+ # Read the image using PIL
45
+ img = Image.open(file.stream)
46
+ # Perform prediction
47
+ prediction = predict_teeth_health(img)
48
+ return jsonify(prediction)
49
+
50
+ if __name__ == '__main__':
51
+ app.run(debug=True)
gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
+ dentella.keras filter=lfs diff=lfs merge=lfs -text
imageclassifier .h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:388a0e596a50467c131590da43adab2e90a013d6e6c1236320e072e4b11df1ad
3
+ size 22375248
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ numpy
2
+ pandas
3
+ catboost==1.2