Will-uob commited on
Commit
ff82b9a
·
1 Parent(s): c1666b8

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +19 -0
  2. model.pkl +3 -0
  3. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision import *
2
+ import gradio as gr
3
+ from fastbook import *
4
+ import os
5
+ import glob
6
+
7
+ def classify_digit_type(img):
8
+ name = os.path.basename(os.path.normpath(img))
9
+ return name[0]
10
+
11
+ learn = load_learner('model.pkl')
12
+
13
+ labels = learn.dls.vocab
14
+ def predict(img):
15
+ img = PILImage.create(img)
16
+ pred,pred_idx,probs = learn.predict(img)
17
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
18
+
19
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7806f6be9acd4d18e80d5140ccd1c85fb265574f39b8439d2a5467c5b5f5754b
3
+ size 47802065
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ fastbook