ihatetommy
edited app.py—change model filename/path
af365b0 unverified
raw
history blame contribute delete
514 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner("comics_classifier1.pkl")
def classify_image(img):
publication, _, probs = learn.predict(img)
return dict(zip(("DC", "Marvel"), map(float, probs)))
image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
examples = ["./ex_img/John_Constantine_0010.jpg", "./ex_img/ambush_bug2.jpg", "./ex_img/blade.jpg"]
intf = gr.Interface(fn=classify_image, inputs=image,outputs=label, examples=examples)
intf.launch(inline=False)