Spaces:
Runtime error
Runtime error
Old-Fat-Boy
commited on
Commit
•
620c9d6
1
Parent(s):
4e9e1af
Initial commit
Browse files- above_average.jpg +0 -0
- app.py +25 -0
- below_average.jpg +0 -0
- bird.jpg +0 -0
- model.pkl +3 -0
- requirements.txt +1 -0
above_average.jpg
ADDED
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
+
|
6 |
+
# %% app.ipynb 2
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# %% app.ipynb 5
|
11 |
+
learn = load_learner('model.pkl')
|
12 |
+
|
13 |
+
# %% app.ipynb 7
|
14 |
+
categories = ('Above Average', 'Below Average')
|
15 |
+
|
16 |
+
def classify_image(img):
|
17 |
+
pred,idx,probs = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float,probs)))
|
19 |
+
|
20 |
+
# %% app.ipynb 9
|
21 |
+
image = gr.inputs.Image(shape=(192,192))
|
22 |
+
label = gr.outputs.Label()
|
23 |
+
examples = ['bird.jpg', 'above_average.jpg', 'below_average.jpg']
|
24 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
25 |
+
intf.launch(inline=False,share=True)
|
below_average.jpg
ADDED
bird.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2849a34b49dfa78235dee107404d7c52825bff6df87061b43a6752c62a87aabe
|
3 |
+
size 46954969
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|