DaniloTertu commited on
Commit
5e2a370
·
1 Parent(s): f2467c6

Upload 5 files

Browse files
Files changed (5) hide show
  1. Number_3.png +0 -0
  2. Number_5.png +0 -0
  3. app.py +21 -0
  4. model.pkl +3 -0
  5. requirements.txt +1 -0
Number_3.png ADDED
Number_5.png ADDED
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ __all__ = ['NumberClass', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
5
+
6
+ def NumberClass(x): return x[0].isupper()
7
+
8
+ learn = load_learner('model.pkl')
9
+
10
+ categories = ('0','1','2','3','4','5','6','7','8','9')
11
+
12
+ def classify_image(img):
13
+ pred, idx, probs = learn.predict(img)
14
+ return pred
15
+
16
+ image = gr.inputs.Image(shape=(192,192))
17
+ label = gr.outputs.Label()
18
+ examples = ['Number_3.jpg', 'Number_5.jpg']
19
+
20
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
21
+ intf.launch(inline=False)
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56257fd8b7a1bd48f2528636b271dc58b97d17012d94301995181250eade864c
3
+ size 103688705
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai