ved1beta
commited on
Commit
·
9fe9116
1
Parent(s):
424ce0d
finaly
Browse files
app.py
CHANGED
@@ -1,7 +1,13 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__all__={'is_cat', "learn" , "classify_image", 'categories', 'image', 'label', 'examples' ,'intf'}
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import gradio as gr
|
4 |
+
learn= load_learner('model.pkl')
|
5 |
+
categories=('Dog','Cat')
|
6 |
+
def classify_image(img):
|
7 |
+
pred,idx,probs=learn.predict(img)
|
8 |
+
return dict(zip(categories, map(float,probs)))
|
9 |
+
image = gr.components.Image(label="Image Input")
|
10 |
+
label= gr.components.Label(label="Image Input")
|
11 |
+
examples = ['dog.jpg','cat.jpg','0002a367-38b4-41c3-a47c-b11e104b394b.jpg']
|
12 |
+
intf=gr.Interface(fn=classify_image, inputs=image, outputs=label , examples=examples)
|
13 |
+
intf.launch(inline= False)
|