initilized
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|
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(3)}
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(224, 224))
|
15 |
+
label = gr.outputs.Label(num_top_classes=2)
|
16 |
+
examples = ["Normal.png", "Tuberculosis.png", "Pneumonia.jpeg"]
|
17 |
+
|
18 |
+
|
19 |
+
intf = gr.Interface(classify,inputs=image, outputs=label, examples=examples, capture_session=True)
|
20 |
+
intf.launch(inline=False)
|