matdmiller's picture
modified: app.py
d2e57c6
raw history blame
No virus
522 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('construction_things.pkl')
def classify_image(img):
pred,idx,probs = learn.predict(img)
return dict(zip(['construction boots', 'construction gloves', 'f150', 'hammer', 'hard hat', 'safety glasses', 'screw driver'],map(float,probs)))
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
interface = gr.Interface(fn=classify_image,inputs=image,outputs=label)
# interface.launch(inline=True)
interface.launch(inline=False)