Spaces:
Runtime error
Runtime error
File size: 796 Bytes
a31b360 0c954bb a31b360 5cfecd7 a31b360 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
from fastai.vision.all import *
import skimage
learn = load_learner('movements_05_02_22_4pm.pkl')
def predict(img):
labels = learn.dls.vocab
im = PILImage.create(img)
pred,pred_idx,probs = learn.predict(im)
return {label: float(prob) for (label,prob) in zip(labels,probs)}
examples = [f"Image{n:02d}.jpg" for n in range(25)]
gr.Interface(fn=predict,
inputs=gr.inputs.Image(shape=((512,512))),
outputs=gr.outputs.Label(num_top_classes=5),
title = "Art Movements",
examples = [f"Image{n:02d}.jpg" for n in range(25)],
description= "What Art Movement Matches the Image Best? Expressionism | Impressionism | Hudson River School | Ukiyo-e | Pre-Raphaelite").launch(share=True, enable_queue=True) |