mmek commited on
Commit
17c19eb
·
1 Parent(s): 17e6e5e

Add app.py

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. app.py +23 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ resnet18.pkl
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner("resnet18.pkl")
5
+
6
+ categories = ("Peacock Spot", "Healthy")
7
+
8
+
9
+ def classify_health(input_img):
10
+ pred, idx, probs = learn.predict(input_img)
11
+ return dict(zip(categories, map(float, probs)))
12
+
13
+
14
+ labels = gr.outputs.Label()
15
+ examples = [
16
+ "examples/healthy.jpg",
17
+ "examples/healthy2.jpg",
18
+ "examples/peacock_spot.jpeg",
19
+ ]
20
+ demo = gr.Interface(
21
+ classify_health, gr.Image(height=224, width=224), outputs=labels, examples=examples
22
+ )
23
+ demo.launch(inline=False)