Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
|
| 2 |
-
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'intf']
|
| 3 |
|
| 4 |
# Cell
|
| 5 |
from fastai.vision.all import *
|
|
@@ -10,7 +10,7 @@ import gradio as gr
|
|
| 10 |
learn = load_learner('model.pkl')
|
| 11 |
|
| 12 |
# Cell
|
| 13 |
-
categories = ('healthy', 'northern-leaf-blight', '
|
| 14 |
|
| 15 |
def classify_image(img):
|
| 16 |
pred,idx,probs = learn.predict(img)
|
|
@@ -19,6 +19,7 @@ def classify_image(img):
|
|
| 19 |
# Cell
|
| 20 |
image = gr.inputs.Image(shape=(192, 192))
|
| 21 |
label = gr.outputs.Label()
|
|
|
|
| 22 |
|
| 23 |
-
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
| 24 |
intf.launch(inline=False)
|
|
|
|
| 1 |
|
| 2 |
+
__all__ = ['learn', 'classify_image', 'examples', 'categories', 'image', 'label', 'intf']
|
| 3 |
|
| 4 |
# Cell
|
| 5 |
from fastai.vision.all import *
|
|
|
|
| 10 |
learn = load_learner('model.pkl')
|
| 11 |
|
| 12 |
# Cell
|
| 13 |
+
categories = ('healthy', 'northern-leaf-blight', 'southern-leaf-blight', 'rust')
|
| 14 |
|
| 15 |
def classify_image(img):
|
| 16 |
pred,idx,probs = learn.predict(img)
|
|
|
|
| 19 |
# Cell
|
| 20 |
image = gr.inputs.Image(shape=(192, 192))
|
| 21 |
label = gr.outputs.Label()
|
| 22 |
+
examples = ['healthy.jpg', 'rust.jpg', 'southern-leaf.jpg', 'southern-leaf.jpg']
|
| 23 |
|
| 24 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 25 |
intf.launch(inline=False)
|