Spaces:
Sleeping
Sleeping
akshaikrishna
commited on
Commit
•
9e1a638
1
Parent(s):
5bf8b59
go
Browse files
app.py
CHANGED
@@ -1,9 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
|
4 |
-
def
|
5 |
-
return
|
6 |
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
|
5 |
+
def is_cat(x):
|
6 |
+
return x[0].isupper()
|
7 |
|
8 |
|
9 |
+
learner = load_learner("model.pkl")
|
10 |
+
|
11 |
+
categories = ("Dog", "Cat")
|
12 |
+
|
13 |
+
|
14 |
+
def classify_image(img):
|
15 |
+
pred, idx, probs = learner.predict(img)
|
16 |
+
return dict(zip(categories, map(float, probs)))
|
17 |
+
|
18 |
+
|
19 |
+
image = gr.Image(height=192, width=192)
|
20 |
+
label = gr.Label()
|
21 |
+
# exam
|
22 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
23 |
+
intf.launch()
|