Card #2
Browse files- .ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
- .ipynb_checkpoints/app-checkpoint.py +7 -0
- Untitled.ipynb +0 -0
- app.py +37 -4
- cat.jpg +0 -0
- cat.jpgZone.Identifier +0 -0
- dog.jpg +0 -0
- dog.jpgZone.Identifier +0 -0
- dunno.jpg +0 -0
- dunno.jpgZone.Identifier +0 -0
- model.pkl +3 -0
- model.pklZone.Identifier +3 -0
.ipynb_checkpoints/Untitled-checkpoint.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.ipynb_checkpoints/app-checkpoint.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def greet(name):
|
| 4 |
+
return "Hello " + name + "!!"
|
| 5 |
+
|
| 6 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
+
iface.launch()
|
Untitled.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# coding: utf-8
|
| 3 |
+
# Dogs vs Cats
|
| 4 |
+
|
| 5 |
+
# In[7]:
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
#|export
|
| 9 |
+
from fastai.vision.all import *
|
| 10 |
import gradio as gr
|
| 11 |
|
| 12 |
+
def is_cat(x): return x[0].isupper()
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# In[9]:
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
#|export
|
| 19 |
+
learn = load_learner('model.pkl')
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# In[12]:
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
#|export
|
| 27 |
+
categories = ('Dog', 'Cat')
|
| 28 |
+
|
| 29 |
+
def classify_image(img):
|
| 30 |
+
pred,idx,probs = learn.predict(img)
|
| 31 |
+
return dict(zip(categories, map(float,probs)))
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
#|export
|
| 35 |
+
image = gr.inputs.Image(shape=(192,192))
|
| 36 |
+
label = gr.outputs.Label()
|
| 37 |
+
examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
|
| 38 |
|
| 39 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 40 |
+
intf.launch(inline=False, share=True)
|
cat.jpg
ADDED
|
cat.jpgZone.Identifier
ADDED
|
File without changes
|
dog.jpg
ADDED
|
dog.jpgZone.Identifier
ADDED
|
File without changes
|
dunno.jpg
ADDED
|
dunno.jpgZone.Identifier
ADDED
|
File without changes
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:98af60c3ac8f0c1add0aabc805ef6f92580fe829fcaf7dd58c081c0e64472183
|
| 3 |
+
size 47060011
|
model.pklZone.Identifier
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[ZoneTransfer]
|
| 2 |
+
ZoneId=3
|
| 3 |
+
HostUrl=https://www.kaggle.com/
|