First bus/house app
Browse files
README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 3.28.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Bus Non Bus
|
| 3 |
+
emoji: 🦀
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 3.28.2
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
app.py
CHANGED
|
@@ -3,23 +3,19 @@ import gradio as gr
|
|
| 3 |
|
| 4 |
def is_cat(x): return x[0].isupper()
|
| 5 |
|
| 6 |
-
# %% auto 0
|
| 7 |
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 8 |
|
| 9 |
-
|
| 10 |
-
learn = load_learner('model.pkl')
|
| 11 |
|
| 12 |
-
|
| 13 |
-
categories = ('Dog', 'Cat')
|
| 14 |
|
| 15 |
def classify_image(img):
|
| 16 |
pred, idx, probs = learn.predict(img)
|
| 17 |
return dict(zip(categories, map(float, probs)))
|
| 18 |
|
| 19 |
-
# %% ../app.ipynb 8
|
| 20 |
image = gr.inputs.Image(shape=(192, 192))
|
| 21 |
label = gr.outputs.Label()
|
| 22 |
-
examples = ['
|
| 23 |
|
| 24 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 25 |
intf.launch(inline=False)
|
|
|
|
| 3 |
|
| 4 |
def is_cat(x): return x[0].isupper()
|
| 5 |
|
|
|
|
| 6 |
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 7 |
|
| 8 |
+
learn = load_learner('bus_house_model.pkl')
|
|
|
|
| 9 |
|
| 10 |
+
categories = ('Bus', 'House')
|
|
|
|
| 11 |
|
| 12 |
def classify_image(img):
|
| 13 |
pred, idx, probs = learn.predict(img)
|
| 14 |
return dict(zip(categories, map(float, probs)))
|
| 15 |
|
|
|
|
| 16 |
image = gr.inputs.Image(shape=(192, 192))
|
| 17 |
label = gr.outputs.Label()
|
| 18 |
+
examples = ['bus.jpg', 'house.jpg', 'dunno.jpg']
|
| 19 |
|
| 20 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 21 |
intf.launch(inline=False)
|
bus.jpg
ADDED
|
cat.jpg
DELETED
|
Binary file (87.8 kB)
|
|
|
dog.jpg
DELETED
|
Binary file (104 kB)
|
|
|
house.jpg
ADDED
|
model.pkl
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:3eb97b9d8879dd3568beb8c62c737c459887acc4573f28e328245344bf1cdb15
|
| 3 |
-
size 47061355
|
|
|
|
|
|
|
|
|
|
|
|