hero_identifier / app.py
oEduardoAfonso
Adding AI model
d8e4171
raw
history blame contribute delete
No virus
540 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
learn.remove_cb(ProgressCallback)
categories = ('Homelander', 'Omniman', 'Superman')
def classify_image(img):
pred, index, prob = learn.predict(img)
return dict(zip(categories, map(float, prob)))
image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
examples = ['homelander.jpg', 'omniman.jpg', 'superman.jpg']
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
iface.launch(inline=False)