main code
Browse files- README.md +3 -3
- app.py +15 -4
- kentish_plover.png +0 -0
- model.pkl +3 -0
- white-faced_plover.png +0 -0
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
title: Kentish Plover And White-faced Plover Classifier
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
1 |
---
|
2 |
title: Kentish Plover And White-faced Plover Classifier
|
3 |
+
emoji: π
|
4 |
+
colorFrom: green
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.13.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
learner = load_learner('model.pkl')
|
|
|
5 |
|
6 |
+
categories = ('Kentish plover', 'White-faced plover')
|
7 |
+
|
8 |
+
def classify_images(img):
|
9 |
+
pred, index, probs = learner.predict(img)
|
10 |
+
return dict(zip(categories, map(float, probs)))
|
11 |
+
|
12 |
+
|
13 |
+
image = gr.Image()
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = ['kentish_plover.png', 'white-faced_plover.png']
|
16 |
+
|
17 |
+
intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
|
18 |
+
intf.launch(inline=False)
|
kentish_plover.png
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d6f4100d6da6b22a3977d35e6aacea55f3fece76ebe06ec2aeb0ed85afea8a7
|
3 |
+
size 46969670
|
white-faced_plover.png
ADDED