archietram's picture
Update app.py
b37f678
from fastai.vision.all import *
import gradio as gr
import pathlib
pathlib.WindowsPath = pathlib.PosixPath
learn = load_learner("export.pkl")
categories = ('CT', 'MRI', "Ultrasound", "X-Ray")
def classify_image(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()
examples = ['mri.jpg','ct.jpg','ultrasound.jpg', 'xray.jpg']
title = 'Medical Image Classifier'
description = 'You need to know whether you are dealing with an MRI , X-Ray, CT, or Ultrasound image, and you need an answer fast? Then you have come to the right place. Upload the picture to classify it.'
article = "Author: <a href=\"https://huggingface.co/archietram\">Archie Tram</a>. "
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title=title, description=description, article=article)
intf.launch(inline=False)