Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,26 +0,0 @@
|
|
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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|