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(5,12)], description= "What is the Mood of the Art? Spring, Summer, Winter or Fall?").launch(share=True, enable_queue=True)