Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from fastai.vision.all import *
|
| 3 |
-
|
| 4 |
-
def is_cat(x): return x[0].isupper()
|
| 5 |
-
learn =load_learner ('model.pkl')
|
| 6 |
-
categories =['dog','Cat']
|
| 7 |
-
def classify_image(img):
|
| 8 |
-
pred,idx,probs = learn.predict(img)
|
| 9 |
-
return dict(zip(categories,map(float,probs)))
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
intf
|
| 18 |
-
intf.launch()
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
|
| 4 |
+
def is_cat(x): return x[0].isupper()
|
| 5 |
+
learn =load_learner ('model.pkl')
|
| 6 |
+
categories =['dog','Cat']
|
| 7 |
+
def classify_image(img):
|
| 8 |
+
pred,idx,probs = learn.predict(img)
|
| 9 |
+
return dict(zip(categories,map(float,probs)))
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
image=gr.inputs.Image(shape=(192,192))
|
| 14 |
+
label =gr.outputs.Label()
|
| 15 |
+
examples = ['dog.jpg','Cat_November_2010-1a.jpg']
|
| 16 |
+
intf =gr.Interface(fn=classify_image,inputs =image,outputs=label,examples=examples)
|
| 17 |
+
intf.launch()
|
|
|