Upload 7 files
Browse files- .gitattributes +2 -0
- GOPR0915.JPG +3 -0
- IMG_5618.jpg +3 -0
- app.py +18 -4
- export.pkl +3 -0
- russian-mail.jpg +0 -0
- russian.jpeg +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
GOPR0915.JPG filter=lfs diff=lfs merge=lfs -text
|
37 |
+
IMG_5618.jpg filter=lfs diff=lfs merge=lfs -text
|
GOPR0915.JPG
ADDED
Git LFS Details
|
IMG_5618.jpg
ADDED
Git LFS Details
|
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
1 |
+
__all__ = ['is_cat', 'learn', 'classify_image', 'categories', 'image', 'label', 'example', 'intf']
|
2 |
+
|
3 |
+
|
4 |
import gradio as gr
|
5 |
+
from fastai.vision.all import *
|
6 |
+
|
7 |
+
def is_cat(x):
|
8 |
+
return x[0].isupper()
|
9 |
+
|
10 |
+
learn = load_learner('export.pkl')
|
11 |
+
categories = ('Indian', 'Russian')
|
12 |
|
13 |
+
def classify_image(img):
|
14 |
+
pred, idx, probs = learn.predict(img)
|
15 |
+
return dict(zip(categories, map(float, probs)))
|
16 |
|
17 |
+
image = gr.inputs.Image(shape=(192, 192))
|
18 |
+
label = gr.outputs.Label()
|
19 |
+
examples = ['GOPRO0915.jpg', 'IMG_5618.jpg', 'russian-mail.jpg']
|
20 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
21 |
+
intf.launch(inline=False)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:285e3e4907ce5fc3eeab83aad64ede5311f202fbea1fd0013501b48f0f12e35c
|
3 |
+
size 46965965
|
russian-mail.jpg
ADDED
russian.jpeg
ADDED