Spaces:
Sleeping
Sleeping
karensanchez
commited on
Commit
·
e19a82e
1
Parent(s):
3e8af46
deployment to huggingface spaces
Browse files- app_baby_facial_expressions.py +25 -0
- cry.jpg +0 -0
- is_baby_smiling.pkl +3 -0
- requirements.txt +0 -0
- smile.jpg +0 -0
app_baby_facial_expressions.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: app_baby_facial_expressions.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
+
|
6 |
+
# %% app_baby_facial_expressions.ipynb 1
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# %% app_baby_facial_expressions.ipynb 3
|
11 |
+
learn=load_learner('is_baby_smiling.pkl')
|
12 |
+
|
13 |
+
# %% app_baby_facial_expressions.ipynb 6
|
14 |
+
categories=('baby crying','baby smiling')
|
15 |
+
def classify_image(img):
|
16 |
+
pred,idx,probability=learn.predict(img)
|
17 |
+
return dict(zip(categories, map(float,probability)))
|
18 |
+
|
19 |
+
# %% app_baby_facial_expressions.ipynb 8
|
20 |
+
image=gr.Image(shape=(192,192))
|
21 |
+
label=gr.Label()
|
22 |
+
examples=['smile.jpg', 'cry.jpg']
|
23 |
+
|
24 |
+
intf=gr.Interface(fn=classify_image, inputs=image, outputs=label, title='Is baby smiling or crying?', examples=examples)
|
25 |
+
intf.launch(inline=False)
|
cry.jpg
ADDED
is_baby_smiling.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3eb2be1669c7c14947e3d75727fa911761abaaebddc2edc30e9aaf7447e589bd
|
3 |
+
size 46966255
|
requirements.txt
ADDED
File without changes
|
smile.jpg
ADDED