Spaces:
Runtime error
Runtime error
Edward Ross
commited on
Commit
•
10af1b1
1
Parent(s):
187b872
Initial model
Browse files- .gitattributes +1 -0
- .gitignore +1 -0
- angry.jpg +0 -0
- app.py +26 -0
- contempt.jpg +0 -0
- disgust.jpg +0 -0
- export.pkl +3 -0
- fear.jpg +0 -0
- happy.jpg +0 -0
- neutral.jpg +0 -0
- requirements.txt +2 -0
- sad.jpg +0 -0
- surprise.jpg +0 -0
.gitattributes
CHANGED
@@ -25,3 +25,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gradio_queue.db
|
angry.jpg
ADDED
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('export.pkl')
|
6 |
+
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
+
|
13 |
+
title = "Emotion Classifier"
|
14 |
+
description = "An emotion classifier trained on AffectNet with fastai. Identifies emotions of anger, contempt, disgust, fear, happy, neutral, surprise, and sad."
|
15 |
+
|
16 |
+
examples = ["happy.jpg", "neutral.jpg", "sad.jpg", "angry.jpg", "contempt.jpg", "fear.jpg", "surprise.jpg", "disgust.jpg"]
|
17 |
+
|
18 |
+
gr.Interface(
|
19 |
+
fn=predict,
|
20 |
+
inputs=gr.inputs.Image(shape=(224, 224)),
|
21 |
+
outputs=gr.outputs.Label(num_top_classes=3),
|
22 |
+
title=title,
|
23 |
+
description=description,
|
24 |
+
examples=examples,
|
25 |
+
enable_queue=True,
|
26 |
+
).launch()
|
contempt.jpg
ADDED
disgust.jpg
ADDED
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1fc5eb70037524e6ec9d011ba612e208a9ac95ed9a9feec0a9d0d84ffac3e3e5
|
3 |
+
size 242786647
|
fear.jpg
ADDED
happy.jpg
ADDED
neutral.jpg
ADDED
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|
sad.jpg
ADDED
surprise.jpg
ADDED