Spaces:
Sleeping
Sleeping
Cooper Richason
commited on
Commit
β’
a9dfa5c
1
Parent(s):
3d92922
add model
Browse files- .DS_Store +0 -0
- README.md +3 -3
- app.py +28 -0
- barbie.jpg +0 -0
- movie_predictions.pkl +3 -0
- requirements.txt +1 -0
- theshinning.jpg +0 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
---
|
2 |
-
title: Movie Predictions
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.7.1
|
|
|
1 |
---
|
2 |
+
title: Movie Genres Predictions
|
3 |
+
emoji: π
|
4 |
+
colorFrom: purple
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.7.1
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../exporter.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'examples', 'demo', 'classify_image']
|
5 |
+
|
6 |
+
# %% ../exporter.ipynb 1
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# %% ../exporter.ipynb 3
|
11 |
+
learn = load_learner('movie_predictions.pkl')
|
12 |
+
|
13 |
+
# %% ../exporter.ipynb 5
|
14 |
+
categories = ('Comedy π','Horror π»')
|
15 |
+
|
16 |
+
def classify_image(img):
|
17 |
+
prediction,idx,probs = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float,probs)))
|
19 |
+
|
20 |
+
# %% ../exporter.ipynb 7
|
21 |
+
examples = ['barbie.jpg','hangover.jpg','theshinning.jpg','freddy.jpg']
|
22 |
+
|
23 |
+
demo = gr.Interface(classify_image, gr.Image(), gr.Label(),
|
24 |
+
examples=examples,
|
25 |
+
title = "Fun or RUN",
|
26 |
+
description = "Image classifier that predicts a movie's genre based on the movie poster!",
|
27 |
+
theme = gr.themes.Base())
|
28 |
+
demo.launch()
|
barbie.jpg
ADDED
movie_predictions.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:22c417b3f68fcdbb2b552f95e6f720352df5768e28043081b14e71f1d8d8b660
|
3 |
+
size 46976818
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|
theshinning.jpg
ADDED