File size: 868 Bytes
08ee717
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from fastai.vision.all import *
from pathlib import Path
import gradio as gr
import skimage

path = Path('export.pkl')
learn_inf = load_learner(path)

def predict(img):
    img = PILImage.create(img)
    pred, pred_idx, probs = learn.predict(img)
    return {labels[i]:float(probs[i]) for i in range(len(labels))}

title = "Pneumonia Classification using Pulmonary X-Ray Images"
description = "An app designed to classify and distinguish between x-ray images of bacterial pneumonia, viral pneumonia and pulmonary health. Developed using the FastAI library and the V7 Lab COVID-19 X-Ray Dataset."
examples = ['xray_1.png']
enable_queue = True

gr.Interface(fn = predict, inputs = gr.inputs.Image(shape = (512, 512)), outputs = gr.outputs.Label(num_top_classes = 3), title = title, description = description, examples = examples, enable_queue = True).launch(share=True)