Spaces:
Runtime error
Runtime error
seamusbarnes commited on
Commit ·
ba428b7
1
Parent(s): cbe7180
update .gitattributes so git lfs will track .pkl files
Browse files- app.py +17 -0
- export.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
learn = load_learner('export.pkl')
|
| 5 |
+
|
| 6 |
+
labels = learn.dls.vocav
|
| 7 |
+
|
| 8 |
+
def predict(img):
|
| 9 |
+
img = PILImage.create(img)
|
| 10 |
+
pred, pred_ind, probs = learn.predict(img)
|
| 11 |
+
return {labels[i]: float(probs[i]) for i in range(len(probs))}
|
| 12 |
+
|
| 13 |
+
gr.Interface(fn=predict,
|
| 14 |
+
inputs='image',
|
| 15 |
+
outputs='label',
|
| 16 |
+
live=True
|
| 17 |
+
).launch(share=True)
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0f6847d083e2234cce756c99228665f29aa0aa3cc3a093892210948d78084aa2
|
| 3 |
+
size 47008723
|