PCTN-classifier / app.py
Saim8250's picture
Update app.py
720db7e
raw
history blame contribute delete
655 Bytes
import fastai
from fastai.vision.all import*
import gradio as gr
import gradio.components as components
from gradio import media_data, processing_utils, utils
from gradio import encryptor, utils
def is_cat(x):returnx[0].isupper()
learn=load_learner('modelcptn.pkl')
categories=('normal','pneumonia','covid19','tuberculosis')
def classify_img(img):
pred,idx,probs=learn.predict(img)
return dict(zip(categories,map(float,probs)))
image =gr.inputs.Image(shape=(192,192))
label =gr.outputs.Label()
example=['Normal.jpg','pneumonia.jpg']
intf=gr.Interface(fn=classify_img,inputs=image,outputs=label,examples=example)
intf.launch(inline=False)