changed app dot py and also added model dot pkl file
Browse files- .DS_Store +0 -0
- app.py +23 -1
- model (1).pkl +3 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
app.py
CHANGED
|
@@ -1,4 +1,26 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# coding: utf-8
|
| 3 |
+
|
| 4 |
+
from fastai.vision.all import *
|
| 5 |
+
import gradio as gr
|
| 6 |
+
|
| 7 |
+
def is_cat(x): return x[0].isupper()
|
| 8 |
+
|
| 9 |
+
learn=load_learner('model (1).pkl')
|
| 10 |
+
|
| 11 |
+
categories =('Dog', 'Cat')
|
| 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 = ['/kaggle/input/dogjpg/dog.jpg', '/kaggle/input/catjpg/cat.jpg', '/kaggle/input/dogcatjpg/dogcat.jpg']
|
| 20 |
+
|
| 21 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
| 22 |
+
intf.launch(inline=False)
|
| 23 |
+
|
| 24 |
|
| 25 |
def greet(name):
|
| 26 |
return "Hello " + name + "!!"
|
model (1).pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:705a57af021740c5a4306ebfad41346145a8911aa31e4d0476f366ccd8e71dc9
|
| 3 |
+
size 47061355
|