Spaces:
Sleeping
Sleeping
Commit
·
be36ad7
1
Parent(s):
6ebda55
initial
Browse files- app.py +17 -0
- export.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastcore.all import *
|
| 2 |
+
from fastai.learner import *
|
| 3 |
+
from fastai.vision.all import *
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
categories = ('confused','attentive', 'bored', 'interested', 'frustrated', 'thoughtful')
|
| 7 |
+
learn_inf = load_learner('export.pkl')
|
| 8 |
+
|
| 9 |
+
def classify_image(img):
|
| 10 |
+
pred,idx,prods = learn_inf.predict(img)
|
| 11 |
+
return dict(zip(categories, map(float,probs)))
|
| 12 |
+
|
| 13 |
+
image = gr.inputs.Image(shape=(192,192))
|
| 14 |
+
label = gr.outputs.Label()
|
| 15 |
+
|
| 16 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
| 17 |
+
intf.launch
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dd032084b3f975e1d4c63b79c5cae78ddf223235b5a0c5dd787907bf96d375bc
|
| 3 |
+
size 46982479
|