JumpyJason commited on
Commit
3608bcb
·
1 Parent(s): 639bc2c
Files changed (2) hide show
  1. app.py +15 -0
  2. export.pkl +3 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ from fastai.vision.widgets import *
3
+ path = Path()
4
+ path.ls(file_exts='.pkl')
5
+ import pathlib
6
+ temp = pathlib.PosixPath
7
+ pathlib.PosixPath = pathlib.WindowsPath
8
+ learn_inf = load_learner(path/'export.pkl')
9
+ labels = learn_inf.dls.vocab
10
+ def on_click_classify(img):
11
+ img = PILImage.create(img)
12
+ pred,pred_idx,probs = learn_inf.predict(img)
13
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
14
+ import gradio as gr
15
+ gr.Interface(fn=on_click_classify, inputs=gr.Image(), outputs=gr.Label(num_top_classes=3)).launch(share=True)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdb387dd77e687559ae108c9064d44d775f4be9a216335f9414ceedd2d68e4ca
3
+ size 46972094