ilancooke commited on
Commit
9ca3635
·
1 Parent(s): 2b6eb61

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +22 -4
  2. export.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,25 @@
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
5
+
6
+ # %% ../app.ipynb 3
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ # %% ../app.ipynb 5
11
+ learn = load_learner('export.pkl')
12
+
13
+ # %% ../app.ipynb 7
14
+ categories = ('Drivers License', 'Passport')
15
+
16
+ def classify_image(img):
17
+ pred, idx, probs = learn.predict(img)
18
+ return dict(zip(categories, map(float, probs)))
19
 
20
+ # %% ../app.ipynb 9
21
+ image = gr.inputs.Image(shape=(192,192))
22
+ label = gr.outputs.Label()
23
+ examples = ['passport.jpg', 'license.jpg', 'passport_card.jpg']
24
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
25
+ intf.launch(inline=False)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cb5214cb067fd2997b8ca57ae49f32e801beec9d2cf0850e77b95815e862c7f
3
+ size 46966543