Jonathon Cwik commited on
Commit
0b94773
1 Parent(s): c69c3cf
Files changed (4) hide show
  1. .gitignore +1 -0
  2. app.py +19 -6
  3. model.pkl +3 -0
  4. requirements.txt +0 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ flagged/
app.py CHANGED
@@ -1,10 +1,23 @@
1
  import gradio as gr
 
 
 
2
 
 
 
3
 
4
- def video_flip(video):
5
- return video
 
 
 
 
 
6
 
7
-
8
- iface = gr.Interface(video_flip, gr.inputs.Video(source="webcam"), "playable_video")
9
-
10
- iface.launch()
 
 
 
 
1
  import gradio as gr
2
+ from nbconvert import export
3
+ import numpy as np
4
+ from fastai.vision.all import *
5
 
6
+ learner = load_learner("model.pkl")
7
+ categories = ('happy', 'upset')
8
 
9
+ def smileOrFrown(im):
10
+ pred,idx,probs = learner.predict(im)
11
+ actualPred = "happy"
12
+ if (pred == "human face upset"):
13
+ actualPred = "upset"
14
+
15
+ return actualPred + " " + str(dict(zip(categories, map(float, probs))))
16
 
17
+ demo = gr.Interface(
18
+ smileOrFrown,
19
+ gr.Image(source="webcam", streaming=True),
20
+ "text",
21
+ live=True
22
+ )
23
+ demo.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73dcd27c7d248ec7f441c9db3dc9430f9cdf631999bc98819917cfccae0e23ad
3
+ size 46955887
requirements.txt ADDED
Binary file (30 Bytes). View file