MohammedAlakhras/DentalClassification
0
1import platform2import pathlib3plt = platform.system()4pathlib.WindowsPath = pathlib.PosixPath5 6 7import requests8 9 10# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.11 12# %% auto 013__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'interface', 'classify_image']14 15# %% app.ipynb 116from fastai.vision.all import *17import PIL.Image18PIL.Image.MAX_IMAGE_PIXELS = None19from PIL import Image20 21import gradio as gr22 23# %% app.ipynb 224learn = load_learner('DentalModel.pkl')25 26# %% app.ipynb 327categories=('Back bridge', 'Complete prosthesis missing all teeth', 'Extraction of root remnants or a tilted wisdom tooth', 'Normal', 'Partial prosthesis (removable) missing 3 or more teeth located next to each other', 'Reprocessing', 'Rotten pulp (periapical lesion) is black around the apex and the decay extends to the nerve', 'The caries restoration did not reach the nerve of the tooth', 'The pulp is not rotten, there is no black around the apex, only the decay has reached the nerve')28 29def classify_image(img):30 pred,indx,probs=learn.predict(img)31 return dict(zip(categories,map(float,probs)))32 33 34# %% app.ipynb 435image=gr.inputs.Image(shape=(512,512))36label=gr.outputs.Label()37 38 39 40interface=gr.Interface(fn=classify_image, inputs=image ,outputs=label)41interface.launch(inline=False)