Spaces:
Sleeping
Sleeping
stephen
commited on
Commit
·
c211e77
1
Parent(s):
1d5dd5d
Changes to be committed:
Browse files
app.py
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
-
iface.launch()
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
learn = load_learner('dog-breed-model.pkl')
|
| 5 |
+
|
| 6 |
+
learn.predict(im)
|
| 7 |
+
|
| 8 |
+
def classify_img(image):
|
| 9 |
+
pred,idx,probs = learn.predict(image)
|
| 10 |
+
return pred.split('-')[1]
|
| 11 |
+
|
| 12 |
+
image = gr.inputs.Image(shape=(192,192))
|
| 13 |
+
label = gr.outputs.Label()
|
| 14 |
+
|
| 15 |
+
examples = ['dog.jpg', 'kelpie.jpg']
|
| 16 |
+
|
| 17 |
+
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
|
| 18 |
+
intf.launch(inline=False)
|
| 19 |
|
|
|
|
|
|