com48com commited on
Commit
cd1d3f7
·
1 Parent(s): 04095d2

initial version

Browse files
Files changed (8) hide show
  1. app.py +27 -0
  2. corn_01.jpg +0 -0
  3. corn_02.jpg +0 -0
  4. corn_03.jpg +0 -0
  5. export.pkl +3 -0
  6. no_corn_01.jpg +0 -0
  7. no_corn_02.jpg +0 -0
  8. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner("export.pkl")
5
+
6
+ labels = learn.dls.vocab
7
+
8
+
9
+ def predict(img):
10
+ img = PILImage.create(img)
11
+ _, _, probs = learn.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ gr.Interface(
15
+ fn=predict,
16
+ inputs=gr.components.Image(shape=(400, 400)),
17
+ outputs=gr.components.Label(num_top_classes=2),
18
+ title="Does my sighthound have a corn?",
19
+ description="given a picture of a paw. does it have a corn?",
20
+ examples=[
21
+ "corn_01.jpg",
22
+ "corn_02.jpg",
23
+ "corn_03.jpg",
24
+ "no_corn_01.jpg",
25
+ "no_corn_02.jpg",
26
+ ],
27
+ ).launch(enable_queue=True)
corn_01.jpg ADDED
corn_02.jpg ADDED
corn_03.jpg ADDED
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:212dd162547e13599c42f1625c1b2b31627278cc2b8d205a403e531bd16a73a4
3
+ size 791507375
no_corn_01.jpg ADDED
no_corn_02.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai==2.7.9