Spaces:
Build error
Build error
John Blake
commited on
Commit
·
d020fec
1
Parent(s):
b3d0c49
deploy to hugging spaces
Browse files- age.pkl +3 -0
- app.py +13 -0
- requirements.txt +2 -0
age.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba6505d28b42296675328eb7c7e33eff07c7a36e14b146d6380a4a9769fd3e14
|
| 3 |
+
size 87548395
|
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import skimage
|
| 4 |
+
|
| 5 |
+
def predict(img):
|
| 6 |
+
img = PILImage.create(img)
|
| 7 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 8 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 9 |
+
|
| 10 |
+
learn = load_learner('age.pkl')
|
| 11 |
+
labels = learn.dls.vocab
|
| 12 |
+
|
| 13 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512,512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
scikit-image
|