Spaces:
Runtime error
Runtime error
Use resnet34 model trained on FER-2013 dataset
Browse files- app.py +8 -3
- model-v4.pkl +3 -0
app.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
iface = gr.Interface(fn=
|
| 7 |
iface.launch()
|
| 8 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
|
| 4 |
+
learn = load_learner('model-v4.pkl')
|
| 5 |
+
labels = learn.dls.vocab
|
| 6 |
+
def predict(img):
|
| 7 |
+
img = PILImage.create(img)
|
| 8 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 10 |
|
| 11 |
+
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(48,48)), outputs=gr.outputs.Label(num_top_classes=3))
|
| 12 |
iface.launch()
|
| 13 |
|
model-v4.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57e120bbe39f8f49182fe92fd6b932d988e43dc758ad378715641ae3bd800977
|
| 3 |
+
size 87860833
|