Ibrahim Animashaun commited on
Commit
9901a12
1 Parent(s): 4fa2c3a

Add application file

Browse files
Files changed (3) hide show
  1. app.py +26 -0
  2. oc_model.h5 +3 -0
  3. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from tensorflow import keras
3
+ from skimage.transform import resize
4
+
5
+ # def greet(name):
6
+ # return "Hello " + name + "!!"
7
+
8
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
9
+ # iface.launch()
10
+
11
+ oc_resnet50_model = keras.models.load_model('oc_model.h5')
12
+ labels = ['Malignant Lesion', 'Benign Lesion']
13
+
14
+ def classify_image(inp):
15
+
16
+ inp =resize(inp, (300, 300, 3))
17
+ inp = inp.reshape((-1, 300, 300, 3))
18
+ # inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
19
+ prediction = oc_resnet50_model.predict(inp).flatten()
20
+ confidences = {labels[i]: float(prediction[i]) for i in range(2)}
21
+ return confidences
22
+
23
+ gr.Interface(fn=classify_image,
24
+ inputs=gr.Image(shape=(300, 300)),
25
+ outputs=gr.Label(num_top_classes=2),
26
+ ).launch()
oc_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17cadbca5ce3eaa1f3b4646f9ce07b8f6cc2b6f065bb251d525514120294849f
3
+ size 2619381592
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ tensorflow
2
+ scikit-image
3
+ gradio
4
+ matplotlib
5
+ numpy