thepainter / app.py
Quake24's picture
updating parameters
ab0fc9e verified
raw
history blame contribute delete
532 Bytes
import gradio as gr
from fastai.vision.all import *
categories = ('Leonardo_da_Vinci', 'Vincent_van_Gogh')
learn = load_learner('painter.pkl')
def classify_painter(img):
painter, _, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.Image(height = 192, width = 192)
label = gr.Label()
examples = ['davinci.jpeg', 'vangogh.jpeg', 'picasso.jpeg']
iface = gr.Interface(fn=classify_painter, inputs=image,
outputs=label, examples=examples)
iface.launch(inline=False)