ClauMS commited on
Commit
46a98b4
·
1 Parent(s): f61fa0e

Model and Interface Ready

Browse files
Files changed (5) hide show
  1. app.py +18 -4
  2. boleta.jpg +0 -0
  3. doc_classifier_model.pkl +3 -0
  4. factura.jpg +0 -0
  5. formulario.jpg +0 -0
app.py CHANGED
@@ -1,7 +1,21 @@
 
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
+ from fastai.vision import *
2
  import gradio as gr
3
 
4
+ learner = load_learner('doc_classifier_model.pkl')
 
5
 
6
+ categories = ['Factura', 'Boleta', 'Formulario']
7
+
8
+ def classify_doc(img):
9
+ pred, idx, probs = learner.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+ image = gr.inputs.Image(shape=(224, 224))
13
+ label = gr.outputs.Label(num_top_classes=3)
14
+ examples = [
15
+ ['factura.jpg'],
16
+ ['boleta.jpg'],
17
+ ['formulario.jpg']
18
+ ]
19
+
20
+ iface = gr.Interface(fn=classify_doc, inputs=image, outputs=label, examples=examples)
21
+ iface.launch(inline=False)
boleta.jpg ADDED
doc_classifier_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e4984ffd183852fd3fbd151ff3087cc2df8a7f7490848de0f77959a0836fe8b
3
+ size 46974219
factura.jpg ADDED
formulario.jpg ADDED