Spaces:
Runtime error
Runtime error
Commit
·
1c2baab
1
Parent(s):
daac700
Tiny app to guess gender of faces
Browse files- .gitattributes +3 -0
- .gitignore +3 -1
- app.py +13 -4
- gender-classifier-model.pkl +3 -0
- man.jpeg +3 -0
- woman.jpeg +3 -0
.gitattributes
CHANGED
@@ -32,3 +32,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
man.jpeg filter=lfs diff=lfs merge=lfs -text
|
36 |
+
woman.jpeg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
gender-classifier-model.pkl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
.idea/
|
|
|
|
|
|
1 |
+
.idea/
|
2 |
+
__pycache__/
|
3 |
+
flagged/
|
app.py
CHANGED
@@ -1,9 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
def is_man(face): return face[0].isupper()
|
5 |
|
6 |
+
learn = load_learner('gender-classifier-model.pkl')
|
7 |
+
categories = 'Man', 'Woman'
|
8 |
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float, probs)))
|
12 |
|
13 |
+
image = gr.Image(shape=(192, 192))
|
14 |
+
label = gr.Label()
|
15 |
+
examples = ['man.jpeg', 'woman.jpeg']
|
16 |
+
|
17 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
18 |
+
intf.launch()
|
gender-classifier-model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ad2299947b0710aa12bf7b52716e91b875b97a810df1a2cac909442953519ba0
|
3 |
+
size 46969822
|
man.jpeg
ADDED
![]() |
Git LFS Details
|
woman.jpeg
ADDED
![]() |
Git LFS Details
|