IbratDO commited on
Commit
fe94dd6
1 Parent(s): a8ec65d

Upload 6 files

Browse files
Files changed (6) hide show
  1. app.py +26 -0
  2. early_blight.JPG +0 -0
  3. eksport.pkl +3 -0
  4. healthy.JPG +0 -0
  5. late_blight.JPG +0 -0
  6. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+ import pathlib
5
+
6
+ temp = pathlib.PosixPath
7
+ pathlib.PosixPath = pathlib.WindowsPath
8
+
9
+ learn = load_learner('eksport.pkl')
10
+
11
+ labels = learn.dls.vocab
12
+ def predict(img):
13
+ img = PILImage.create(img)
14
+ pred, pred_idx, probs = learn.predict(img)
15
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
16
+
17
+ title = 'Potato Disease Classifier'
18
+ description = 'A potato disease classifier trained on random images from internet with fastai. Created as a demo for Gradio and HuggingFace Spaces.'
19
+ examples = ['early_blight.JPG', 'healthy.JPG', 'late_blight.JPG']
20
+
21
+ gr.Interface(fn = predict,
22
+ inputs = 'image',
23
+ outputs = 'label',
24
+ title = title,
25
+ description = description,
26
+ examples = examples).launch()
early_blight.JPG ADDED
eksport.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a0079a4545c9ed6c4adc0609ac56694eaae279189ce6315ea91060dac8d21c9
3
+ size 46971087
healthy.JPG ADDED
late_blight.JPG ADDED
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image