File size: 630 Bytes
020fe74
b62627a
6a5ede1
020fe74
6a5ede1
 
 
020fe74
6a5ede1
 
 
 
 
 
 
71b2c34
6a5ede1
 
c6f337b
6a5ede1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
#import joblib
import tensorflow as tf

#model = joblib.load('model.pkl')
model = tf.keras.models.load_model('best_model.h5')
categories = ["Normal", "Tubercolosis"] #"Pneumonia", "Covid-19"

def classify(img):
    img = img.reshape((-1, 224, 224, 3))
    pred = model.predict(img)[0]
    return {categories[i]: float(pred[i]) for i in range(2)}

image = gr.inputs.Image(shape=(224, 224))
label = gr.outputs.Label(num_top_classes=2)
examples = ["Normal.png", "Tuberculosis.png"]
    

intf = gr.Interface(classify,inputs=image, outputs=label, examples=examples, capture_session=True)
intf.launch(inline=False)