Spaces:
Runtime error
Runtime error
Commit
·
564df32
1
Parent(s):
a05f597
here we go
Browse files
app.py
CHANGED
@@ -1,8 +1,19 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner("dog_detect.pkl")
|
|
|
5 |
|
6 |
+
def classify_image(img):
|
7 |
+
pred,idx,probs = learn.predict(img)
|
8 |
+
return dict(zip(learn.dls.vocab, map(float,probs)))
|
9 |
+
|
10 |
+
#im = PILImage.create("1.jpg")
|
11 |
+
#print (classify_image(im))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(192,192))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = ['golden.jpg', 'lab.jpg', 'corgi.jpg']
|
16 |
+
|
17 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
18 |
+
intf.launch(inline=False)
|
19 |
|