Spaces:
Sleeping
Sleeping
Commit
·
b899583
1
Parent(s):
bf1160c
Novo modelo
Browse files- airplane.jpg +0 -0
- app.py +4 -4
- helicopter.jpg +0 -0
- model.pkl +1 -1
airplane.jpg
ADDED
|
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
|
| 4 |
-
__all__ = ['
|
| 5 |
|
| 6 |
-
def
|
| 7 |
|
| 8 |
learn = load_learner('model.pkl')
|
| 9 |
|
| 10 |
-
categories = ('
|
| 11 |
|
| 12 |
def classify_image(img):
|
| 13 |
pred, idx, probs = learn.predict(img)
|
|
@@ -15,7 +15,7 @@ def classify_image(img):
|
|
| 15 |
|
| 16 |
image = gr.inputs.Image(shape=(192,192))
|
| 17 |
label = gr.outputs.Label()
|
| 18 |
-
examples = ['
|
| 19 |
|
| 20 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 21 |
intf.launch(inline=False)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
|
| 4 |
+
__all__ = ['is_airplane', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
|
| 5 |
|
| 6 |
+
def is_airplane(x): return x[0].isupper()
|
| 7 |
|
| 8 |
learn = load_learner('model.pkl')
|
| 9 |
|
| 10 |
+
categories = ('Helicopter', 'Airplane')
|
| 11 |
|
| 12 |
def classify_image(img):
|
| 13 |
pred, idx, probs = learn.predict(img)
|
|
|
|
| 15 |
|
| 16 |
image = gr.inputs.Image(shape=(192,192))
|
| 17 |
label = gr.outputs.Label()
|
| 18 |
+
examples = ['airplane.jpg', 'helicopter.jpg']
|
| 19 |
|
| 20 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 21 |
intf.launch(inline=False)
|
helicopter.jpg
ADDED
|
model.pkl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 46950545
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ae4d1d50da7398197632361c42e2908c7eebd22ef86be08a45e55bd5df58886
|
| 3 |
size 46950545
|