IbratDO commited on
Commit
cc07a63
1 Parent(s): 5acb5d8

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +26 -0
  2. eksport1.pkl +3 -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('eksport1.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()
eksport1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69af0dd3fe72b9a1406e02b9c42c4b19a075fd574cf8d1b67f710e5156589f15
3
+ size 47019827