Spaces:
Runtime error
Runtime error
NassimeBejaia
commited on
Commit
•
251ff9c
1
Parent(s):
f4d9c66
Update app.py
Browse files
app.py
CHANGED
@@ -125,19 +125,22 @@ def extract_heads(filepath, frame0):
|
|
125 |
|
126 |
#*********************************************************************************************
|
127 |
def display_heads_(nbperson, listhead):
|
128 |
-
|
129 |
-
|
130 |
k = 0
|
131 |
-
for i in range(1,
|
132 |
-
cols = st.columns(
|
133 |
-
for j in range(1,
|
134 |
k = k + 1
|
135 |
cols[j].header("Person " + str(k))
|
136 |
-
cols[j].image(listhead[k], use_column_width=True, width=150)
|
137 |
return
|
138 |
|
139 |
#*********************************************************************************************
|
140 |
|
|
|
|
|
|
|
141 |
|
142 |
|
143 |
|
@@ -156,6 +159,13 @@ def main():
|
|
156 |
st.success("Click again to retry or try a different video by uploading")
|
157 |
nbperson, listhead = extract_heads(filepath, frame0)
|
158 |
display_heads_(nbperson, listhead)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
return
|
161 |
|
|
|
125 |
|
126 |
#*********************************************************************************************
|
127 |
def display_heads_(nbperson, listhead):
|
128 |
+
rows_ = 10
|
129 |
+
cols_ = 5
|
130 |
k = 0
|
131 |
+
for i in range(1, rows_):
|
132 |
+
cols = st.columns(cols_)
|
133 |
+
for j in range(1, cols_):
|
134 |
k = k + 1
|
135 |
cols[j].header("Person " + str(k))
|
136 |
+
cols[j].image(listhead[k], use_column_width=True, width=150, caption = str(k) )
|
137 |
return
|
138 |
|
139 |
#*********************************************************************************************
|
140 |
|
141 |
+
|
142 |
+
|
143 |
+
|
144 |
|
145 |
|
146 |
|
|
|
159 |
st.success("Click again to retry or try a different video by uploading")
|
160 |
nbperson, listhead = extract_heads(filepath, frame0)
|
161 |
display_heads_(nbperson, listhead)
|
162 |
+
if st.button('Continue to face analysis!'):
|
163 |
+
os.system('pip install deepface')
|
164 |
+
from deepface import DeepFace
|
165 |
+
obj = DeepFace.analyze(img_path = listhead[1], actions = ['age', 'gender', 'race', 'emotion'])
|
166 |
+
st.write(obj)
|
167 |
+
|
168 |
+
|
169 |
|
170 |
return
|
171 |
|