Cooper Richason
fix app.py
d1c517a
raw
history blame contribute delete
905 Bytes
# AUTOGENERATED! DO NOT EDIT! File to edit: ../exporter.ipynb.
# %% auto 0
__all__ = ['learn', 'categories', 'examples', 'demo', 'classify_image']
# %% ../exporter.ipynb 3
import gradio.themes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('movie_predictions.pkl')
# %% ../exporter.ipynb 5
categories = ('Comedy πŸ˜‚','Horror πŸ‘»')
def classify_image(img):
prediction,idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
# %% ../exporter.ipynb 7
examples = ['barbie.jpg','hangover.jpg','theshinning.jpg','freddy.jpg','wish.jpg']
demo = gr.Interface(classify_image, gr.Image(), gr.Label(),
examples=examples,
title = "Fun or RUN?",
description = "Image classifier that predicts a movie's genre based on the movie poster!",
theme='gradio/soft')
demo.launch()