added basic model
Browse files
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: pink
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.24.1
|
8 |
app_file: app.py
|
|
|
1 |
---
|
2 |
+
title: Tiger2
|
3 |
+
emoji: π
|
4 |
colorFrom: pink
|
5 |
+
colorTo: pink
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.24.1
|
8 |
app_file: app.py
|
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def is_cat(x): return x[0].isupper()
|
5 |
+
|
6 |
+
|
7 |
+
learn = load_learner('model.pkl')
|
8 |
+
categories = ('Dog', 'Cat')
|
9 |
+
|
10 |
+
def classify_img(img):
|
11 |
+
preds, idx, probs = learn.predict(img)
|
12 |
+
return dict(zip(categories, map(float, probs)))
|
13 |
+
|
14 |
+
image = gr.input.Image(shape=(192, 192))
|
15 |
+
label = gr.output.Label()
|
16 |
+
examples = ['dog.jpg', 'cat.jpg']
|
17 |
+
|
18 |
+
iface = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
|
19 |
+
iface.launch()
|
cat.jpg
ADDED
dog.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a0770edf8e87d6c7bdbd916114bb4dd38dfca0af89a62adfefbc1452873c19d3
|
3 |
+
size 47061419
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|