jumashafara commited on
Commit
e4646c3
·
1 Parent(s): 8b3e78a

added app.py and model file

Browse files
Files changed (3) hide show
  1. .gitignore +5 -0
  2. app.py +23 -0
  3. corn_fastai_model.pkl +3 -0
.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ /Include
2
+ /Lib
3
+ /Scripts
4
+ /share
5
+ pyvenv.cfg
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import timm
2
+ import gradio as gr
3
+ from pathlib import Path
4
+ from fastai.vision.all import *
5
+
6
+ categories = ['cercospora', 'common_rust', 'healthy', 'northern_leaf_blight']
7
+
8
+ learner = load_learner(Path('tomato_resnet50.pkl'))
9
+
10
+ def classify(img):
11
+ category, index, probs = learner.predict(img)
12
+ return (dict(zip(categories, map(float, probs))))
13
+
14
+ image = gr.inputs.Image(shape=(224))
15
+ label = gr.outputs.Label()
16
+ example = []
17
+
18
+ interface = gr.Interface(fn=classify,
19
+ inputs='image',
20
+ outputs='label',
21
+ example=example)
22
+
23
+ interface.launch()
corn_fastai_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b05d4e10e244d6c596112ad56a24cffd2dc1d4b1d4d951077fda2540dc996493
3
+ size 103021797