File size: 678 Bytes
64faf29
 
 
 
76a852a
64faf29
 
76a852a
 
 
 
 
 
 
 
 
 
 
 
 
64faf29
 
76a852a
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
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)