File size: 1,194 Bytes
6af0ef0
 
 
 
 
 
 
ee93b26
ec5bd54
6af0ef0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5626d0a
290c3f9
fb2c01a
 
 
 
 
 
5626d0a
fb2c01a
 
5626d0a
6c30bb5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing import image

model = tf.keras.models.load_model('model.hdf5')

def predict(Image):
    test_image = tf.image.resize(Image,[224,224])
    test_image = image.img_to_array(test_image)
    test_image = test_image/255.0
    test_image = np.expand_dims(test_image, axis = 0) 
    prediction = model.predict(test_image)
    result = np.argmax(prediction, axis=1)
    if result[0] == 0:
        prediction = 'COVID DETECTED'
    elif result[0] == 1:
        prediction = 'HEALTHY'
    elif result[0] == 2:
        prediction = 'LUNG CANCER DETECTED'
    else:
        prediction = 'PNEUMONIA DETECTED'
    return prediction

title = "CT-iRAD"
description = "Welcome to CT-iRAD -- a web based decision support system for radiologists when screening lung diseases -- COVID-19, LUNG CANCER and PNEUMONIA -- in CT images. Please Upload the CT scan image for screening below."
examples = [
    ["covid.jpg"],
    ["healthy.jpg"],
    ["lung cancer.jpg"],
    ["pneumonia.jpg"]
]

iRAD = gr.Interface(predict,"image","text",
title=title,description=description,examples=examples,theme="peach")

iRAD.launch()