dpv commited on
Commit
047d79c
·
1 Parent(s): e4286e0

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import*
2
+ import gradio as gr
3
+ learn1 = load_learner('stage1.pkl')
4
+
5
+ categories1 = 'discarded clothing', 'food waste', 'plastic bags', 'recyc_no_scrap', 'scrap metal piece', 'wood scraps'
6
+
7
+
8
+ def classify_stage1(img):
9
+ pred, idx, probs = learn1.predict(img)
10
+ return dict(zip(categories1, map(float,probs)))
11
+
12
+ image1 = gr.inputs.Image(shape=(192,192))
13
+ label1 = gr.outputs.Label()
14
+ examples1 = ['stage1ex1_t.jpeg', 'stage1ex2_t.jpeg','stage1ex3_t.jpeg','stage1ex4_t.jpeg', 'stage1ex5_t.jpeg','stage1ex6_t.jpeg']
15
+ intf1 = gr.Interface(fn=classify_stage1, inputs = image1, outputs = label1, examples = examples1)
16
+ intf1.launch(inline=False)