Art_Mood / app.py
prairie-guy's picture
added examples
20ee3aa
import gradio as gr
from fastai.vision.all import *
import skimage
learn = load_learner('export.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)}
gr.Interface(fn=predict,
inputs=gr.inputs.Image(shape=((400,400))),
outputs=gr.outputs.Label(num_top_classes=4),
title = "Art Mood",
examples = [f'_Image{i}.jpg' for i in range(1,12)],
description= "Does this Art make you think of Spring, Summer, Winter or Fall? Do you agree with the Prediction?").launch(share=True, enable_queue=True)