Spaces:
Running
Running
thebenfirsty
commited on
Commit
•
18e5c8d
1
Parent(s):
4c2e4ed
Added app.py and pkl file
Browse files- app.py +13 -0
- export-2.pkl +3 -0
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import fastai
|
3 |
+
from fastai.vision.all import *
|
4 |
+
|
5 |
+
learn = load_learner('export-2.pkl')
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
def predict(img):
|
8 |
+
img = PILImage.create(img)
|
9 |
+
pred,pred_idx,probs = learn.predict(img)
|
10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs=gr.Label(num_top_classes=3)).launch(share=True)
|
13 |
+
|
export-2.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4af169d6f0c609a15f7e1f29443f29bff6b5a41cd0e98787cfc2ac6ff2bf4ddc
|
3 |
+
size 102921887
|