model deployed
Browse files- Normal-2.png +0 -0
- Tuberculosis-24.png +0 -0
- app.py +17 -4
- best_model.h5 +3 -0
Normal-2.png
ADDED
![]() |
Tuberculosis-24.png
ADDED
![]() |
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import joblib
|
3 |
+
import tensorflow as tf
|
4 |
|
5 |
+
#model = joblib.load('model.pkl')
|
6 |
+
model = tf.keras.models.load_model('best_model.h5')
|
7 |
+
categories = ["Normal", "Tubercolosis"] #"Pneumonia", "Covid-19"
|
8 |
|
9 |
+
def classify(img):
|
10 |
+
img = img.reshape((-1, 224, 224, 3))
|
11 |
+
pred = model.predict(img)[0]
|
12 |
+
return {categories[i]: float(pred[i]) for i in range(2)}
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(224, 224))
|
15 |
+
label = gr.outputs.Label(num_top_classes=2)
|
16 |
+
examples = ["Normal-2.png", "Tubercolosis-24.png"]
|
17 |
+
|
18 |
+
|
19 |
+
intf = gr.Interface(classify,inpuys=image, outputs=label, examples=examples, capture_session=True)
|
20 |
+
intf.launch(inline=False)
|
best_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:16a7ffaf91f83a0375ef297dc148de790e990ffccc4037a5aa68b3a7b3849e85
|
3 |
+
size 363638328
|