ttcielott commited on
Commit
2b17328
·
1 Parent(s): b362073

initial upload

Browse files
Files changed (6) hide show
  1. app.py +34 -0
  2. cam_mit.jpg +0 -0
  3. dunphys.jpg +0 -0
  4. export_ver1.pkl +3 -0
  5. group.jpg +0 -0
  6. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio.components import Image, Textbook
3
+ from fastai.vision.all import *
4
+
5
+ learn = load_learner('export_ver1.pkl')
6
+
7
+ def get_headcount(filepath):
8
+ filepath = str(filepath)
9
+ filename = filepath.split('/')[-1]
10
+
11
+ return df[df['Name'] == filename]['HeadCount'].values[0]
12
+
13
+ def predict(img):
14
+ img = PILImage.create(img)
15
+ op = learn.predict(img)
16
+ return int(op[0][0])
17
+
18
+
19
+
20
+
21
+ title = "Face count"
22
+ description = "This model that is trained to counts the number of faces in the uploaded picture."
23
+
24
+ eg = ['cam_mit.jpg', 'dunphys.jpg', 'group.jpg']
25
+
26
+ gr.Interface(
27
+ fn=predict,
28
+ inputs=Image(shape=(512, 512)),
29
+ outputs=Textbox(type="number", label="Number of faces"),
30
+ title=title,
31
+ description=description,
32
+ examples=eg,
33
+ ).launch(share=False)
34
+
cam_mit.jpg ADDED
dunphys.jpg ADDED
export_ver1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58cf5953ff9d8d1a561bed808bf360774035b9c14461fd38170ae4847193463e
3
+ size 87547757
group.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai