Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from deepface import DeepFace
|
3 |
+
|
4 |
+
st.title("DeepFace Face Analysis")
|
5 |
+
|
6 |
+
uploaded_file = st.file_uploader("Upload an image for face analysis:", type=["jpg", "png", "jpeg"])
|
7 |
+
|
8 |
+
if uploaded_file is not None:
|
9 |
+
# Perform DeepFace analysis
|
10 |
+
analysis_result = DeepFace.analyze(img_path=uploaded_file, actions=['age', 'gender', 'race', 'emotion'])
|
11 |
+
|
12 |
+
# Display analysis results
|
13 |
+
st.write("Age:", analysis_result['age'])
|
14 |
+
st.write("Gender:", analysis_result['gender'])
|
15 |
+
st.write("Race:", analysis_result['dominant_race'])
|
16 |
+
st.write("Emotion:", analysis_result['dominant_emotion'])
|