Spaces:
Running
Running
Commit
•
7416f8c
1
Parent(s):
27180e3
Add application file
Browse files
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def is_cat(x) : return x[0].isupper()
|
5 |
+
learn = load_learner('model.pkl')
|
6 |
|
7 |
+
categories = ('Cat','Dog')
|
8 |
+
|
9 |
+
def classify_images(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories,map(float,probs)))
|
12 |
+
|
13 |
+
intf=gr.Interface(fn=classify_images,inputs=gr.Image(height=192,width=192),outputs=gr.Label(),examples=['dog.jpg','cat.jpg','dunno.jpg'])
|
14 |
+
intf.launch()
|