Spaces:
Sleeping
Sleeping
Ramon Perez
commited on
Commit
·
5e826a5
1
Parent(s):
5251202
app and reqs
Browse files- app.py +23 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
from glob import glob
|
4 |
+
|
5 |
+
learn_inf = load_learner('model.pkl')
|
6 |
+
|
7 |
+
categories = ("Decease", "Healthy")
|
8 |
+
|
9 |
+
def classify(img):
|
10 |
+
pred, pred_idx, probs = learn_inf.predict(img)
|
11 |
+
return dict(zip(categories, map(float, probs)))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(224, 224))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = glob("images/*.jpg")
|
16 |
+
|
17 |
+
title = "Strawberry Leaves Decease Classifier"
|
18 |
+
description = "This classifier was trained on the 'Image Dataset for Tipburn Disorder Detection in Strawberry Leaves' and it is designed to help you detect weather straberry leaves are infected or not."
|
19 |
+
interpretation='default'
|
20 |
+
|
21 |
+
iface = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples,
|
22 |
+
title=title, description=description, interpretation=interpretation)
|
23 |
+
iface.launch(enable_queue=True)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|