Upload 7 files
Browse files- .gitattributes +2 -0
- app.py +20 -0
- bears_model.pk1 +3 -0
- black_bear.jpeg +0 -0
- grizzly_bear.jpeg +3 -0
- not_sure.jpeg +0 -0
- requirements.txt +9 -0
- teddy_bear.jpeg +0 -0
.gitattributes
CHANGED
@@ -32,3 +32,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
bears_model.pk1 filter=lfs diff=lfs merge=lfs -text
|
36 |
+
grizzly_bear.jpeg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__all__ = ['is_cat', 'learner_pets', 'categories', 'classify_pet', 'image', 'label', 'examples', 'intf']
|
2 |
+
|
3 |
+
from fastai.vision.all import *
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
|
7 |
+
learner_bears = load_learner('bears_model.pk1')
|
8 |
+
categories = ['teddy bear', 'grizzly bear', 'black bear']
|
9 |
+
|
10 |
+
def classify_bears(img):
|
11 |
+
prediction, index, probability = learner_bears.predict(img)
|
12 |
+
return dict(zip(categories, map(float, probability)))
|
13 |
+
|
14 |
+
intf = gr.Interface(fn=classify_bears,
|
15 |
+
inputs=gr.Image(shape=(192, 192)),
|
16 |
+
outputs=gr.Label(),
|
17 |
+
examples=['grizzly_bear.jpeg', 'black_bear.jpeg, 'teddy_bear.jpeg', 'not_sure.jpeg'])
|
18 |
+
intf.launch(inline=False)
|
19 |
+
|
20 |
+
|
bears_model.pk1
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f0b8bebf6d799cd17154430a5533e5568539e654219e45800abdf357f139d65a
|
3 |
+
size 46975009
|
black_bear.jpeg
ADDED
grizzly_bear.jpeg
ADDED
Git LFS Details
|
not_sure.jpeg
ADDED
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{\rtf1\ansi\ansicpg1252\cocoartf2706
|
2 |
+
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
3 |
+
{\colortbl;\red255\green255\blue255;}
|
4 |
+
{\*\expandedcolortbl;;}
|
5 |
+
\margl1440\margr1440\vieww11520\viewh8400\viewkind0
|
6 |
+
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
7 |
+
|
8 |
+
\f0\fs24 \cf0 fastai\
|
9 |
+
gradio}
|
teddy_bear.jpeg
ADDED