igauk's picture
Update app
76a852a
"""
My first gradio application, used to practice the deployment of a deep learning model
"""
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
devonian_invertebrates = (
"Agnostida",
"Ammonites",
"Brachiopods",
"Bryozoa",
"Cephalopods",
"Corals",
"Crinoids",
"Gastropods",
"Nautiloids",
"Trilobites",
)
def classify_image(image):
_,_,probs = learn.predict(image)
return dict(zip(devonian_invertebrates, map(float, probs)))
image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label).launch(inline=False)