Spaces:
Sleeping
Sleeping
File size: 832 Bytes
a9dfa5c d404b5f a9dfa5c d404b5f a9dfa5c d404b5f a9dfa5c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../exporter.ipynb.
# %% auto 0
__all__ = ['learn', 'categories', 'examples', 'demo', 'classify_image']
# %% ../exporter.ipynb 3
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()
|