New Test
Browse files
app.py
CHANGED
@@ -1,22 +1,19 @@
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
|
4 |
-
|
5 |
-
# return "Hello " + name + "!!"
|
6 |
-
im = PILImage.create('Cat.jpg')
|
7 |
|
8 |
-
categories = ('Dog','Cat')
|
9 |
learn = load_learner('model.pkl')
|
10 |
|
11 |
-
|
12 |
-
return x[0].isupper()
|
13 |
|
14 |
def classify_image(img):
|
15 |
pred,idx,probs = learn.predict(img)
|
16 |
return dict(zip(categories,map(float,probs)))
|
17 |
|
18 |
-
# classify_image(im)
|
19 |
-
|
20 |
image = gr.inputs.Image(shape = (192,192))
|
21 |
label = gr.outputs.Label()
|
22 |
examples = ['./Cat.jpg','./dog.jpg','./heh.jpg']
|
@@ -24,6 +21,3 @@ examples = ['./Cat.jpg','./dog.jpg','./heh.jpg']
|
|
24 |
intf = gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
|
25 |
intf.launch(inline=False,share=True)
|
26 |
|
27 |
-
|
28 |
-
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
29 |
-
# iface.launch(share='True')
|
|
|
1 |
+
|
2 |
+
__all__ = ['is_cat','learn','classify_image','categories','image','label','examples','intf']
|
3 |
+
|
4 |
import gradio as gr
|
5 |
from fastai.vision.all import *
|
6 |
|
7 |
+
def is_cat(x):return x[0].isupper()
|
|
|
|
|
8 |
|
|
|
9 |
learn = load_learner('model.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 = ['./Cat.jpg','./dog.jpg','./heh.jpg']
|
|
|
21 |
intf = gr.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
|
22 |
intf.launch(inline=False,share=True)
|
23 |
|
|
|
|
|
|
model.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ee9254b92f59e150474a7edd0624588c77c72d5ccee9f03f0e74f1ebb4ebff91
|
3 |
+
size 47061547
|