Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import load_learner, PILImage
|
3 |
-
|
4 |
-
|
5 |
learn = load_learner('model.pkl')
|
6 |
|
7 |
def classify_image(image):
|
8 |
-
pred,
|
9 |
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
|
10 |
|
11 |
interface = gr.Interface(
|
12 |
fn=classify_image,
|
13 |
-
inputs=gr.
|
14 |
-
outputs=gr.
|
15 |
title="Potato Plant Disease Classifier",
|
16 |
-
description="Potato leaf:
|
17 |
)
|
18 |
|
19 |
if __name__ == "__main__":
|
20 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import load_learner, PILImage
|
3 |
+
|
|
|
4 |
learn = load_learner('model.pkl')
|
5 |
|
6 |
def classify_image(image):
|
7 |
+
pred, _, probs = learn.predict(image)
|
8 |
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
|
9 |
|
10 |
interface = gr.Interface(
|
11 |
fn=classify_image,
|
12 |
+
inputs=gr.Image(type='pil'), # Updated to new API
|
13 |
+
outputs=gr.Label(num_top_classes=3), # Updated to new API
|
14 |
title="Potato Plant Disease Classifier",
|
15 |
+
description="Potato leaf:"
|
16 |
)
|
17 |
|
18 |
if __name__ == "__main__":
|
19 |
+
interface.launch(share=True)
|