Art_Movement / app.py
davidrd123's picture
updated app.py, changed image file order
a61203d
raw
history blame contribute delete
882 Bytes
import gradio as gr
from fastai.vision.all import *
import skimage
learn = load_learner('movements_05_02_22_4pm.pkl')
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn.predict(img)
return {labels[i]: float(probs[i]) for i in range(len(labels))}
examples = [f"Image{n:02d}.jpg" for n in range(23)]
interpretation='default'
title = "Art Movement Classifier"
description = "What Art Movement Matches the Image Best? Expressionism | Impressionism | Hudson River School | Ukiyo-e | Pre-Raphaelite"
gr.Interface(fn=predict,
inputs=gr.inputs.Image(shape=((512,512))),
outputs=gr.outputs.Label(num_top_classes=5),
title = title,
examples = examples,
interpretation = interpretation,
description = description).launch(share=True, enable_queue=True)