lowrollr commited on
Commit
9f38b11
1 Parent(s): 63944d7

george app

Browse files
Files changed (8) hide show
  1. app.py +26 -0
  2. export.pkl +3 -0
  3. george1.jpeg +0 -0
  4. george2.jpg +0 -0
  5. george3.jpeg +0 -0
  6. not_george1.jpg +0 -0
  7. not_george2.jpg +0 -0
  8. not_george3.jpg +0 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import load_learner
3
+
4
+ model = load_learner('export.pkl')
5
+
6
+ categories = ('george', 'not_george')
7
+
8
+ def classify_bird(img):
9
+ pred, idx, probs = model.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+ image = gr.inputs.Image(shape=(256, 256))
13
+ label = gr.outputs.Label(num_top_classes=5)
14
+
15
+ examples = ['george1.jpeg', 'george2.jpg', 'george3.jpeg', 'not_george1.jpg', 'not_george2.jpg', 'not_george3.jpg']
16
+
17
+ iface = gr.Interface(
18
+ fn=classify_bird,
19
+ inputs=image,
20
+ outputs=label,
21
+ examples=examples,
22
+ title='George Classifier',
23
+ description='Determines whether an image is of george',
24
+ allow_flagging='never'
25
+ )
26
+ iface.launch()
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f9a40c1640c5f84c8e6c616384689eb8a83eaf3b97c8848b053722c70ad11b7
3
+ size 46959083
george1.jpeg ADDED
george2.jpg ADDED
george3.jpeg ADDED
not_george1.jpg ADDED
not_george2.jpg ADDED
not_george3.jpg ADDED