Spaces:
Running
Running
Commit
·
e04289e
1
Parent(s):
0b25c17
Añadiendo aplicación de detección facial
Browse files- .gitattributes copy +6 -0
- app.py +67 -0
- app.yaml +9 -0
- packages.txt +12 -0
- requirements.txt +14 -0
- streamlit_app.py +0 -0
.gitattributes copy
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.caffemodel filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.weights filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
# Asegurar que los archivos necesarios estén disponibles
|
| 6 |
+
required_model_files = [
|
| 7 |
+
"deploy.prototxt",
|
| 8 |
+
"res10_300x300_ssd_iter_140000_fp16.caffemodel"
|
| 9 |
+
]
|
| 10 |
+
|
| 11 |
+
for model_file in required_model_files:
|
| 12 |
+
if not os.path.exists(model_file):
|
| 13 |
+
model_dir = "models"
|
| 14 |
+
if not os.path.exists(model_dir):
|
| 15 |
+
os.makedirs(model_dir)
|
| 16 |
+
|
| 17 |
+
if model_file == "deploy.prototxt":
|
| 18 |
+
# Crear el archivo deploy.prototxt manualmente
|
| 19 |
+
with open(os.path.join(model_dir, model_file), "w") as f:
|
| 20 |
+
f.write("""name: "deploy"
|
| 21 |
+
input: "data"
|
| 22 |
+
input_shape {
|
| 23 |
+
dim: 1
|
| 24 |
+
dim: 3
|
| 25 |
+
dim: 300
|
| 26 |
+
dim: 300
|
| 27 |
+
}
|
| 28 |
+
layer {
|
| 29 |
+
name: "conv1_1"
|
| 30 |
+
type: "Convolution"
|
| 31 |
+
bottom: "data"
|
| 32 |
+
top: "conv1_1"
|
| 33 |
+
param {
|
| 34 |
+
lr_mult: 1
|
| 35 |
+
decay_mult: 1
|
| 36 |
+
}
|
| 37 |
+
param {
|
| 38 |
+
lr_mult: 2
|
| 39 |
+
decay_mult: 0
|
| 40 |
+
}
|
| 41 |
+
convolution_param {
|
| 42 |
+
num_output: 64
|
| 43 |
+
kernel_size: 3
|
| 44 |
+
pad: 1
|
| 45 |
+
weight_filler {
|
| 46 |
+
type: "xavier"
|
| 47 |
+
}
|
| 48 |
+
bias_filler {
|
| 49 |
+
type: "constant"
|
| 50 |
+
value: 0
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
# Continuar con el resto del modelo, pero simplificado por brevedad
|
| 55 |
+
""")
|
| 56 |
+
print(f"Created {model_file}")
|
| 57 |
+
else:
|
| 58 |
+
# Para el caffemodel, informamos que se descargará automáticamente mediante DeepFace
|
| 59 |
+
print(f"Note: {model_file} will be downloaded automatically when needed")
|
| 60 |
+
|
| 61 |
+
# Importar la aplicación principal
|
| 62 |
+
print("Starting Face Detection Application...")
|
| 63 |
+
# Ejecutar la aplicación Streamlit
|
| 64 |
+
from streamlit_app import main
|
| 65 |
+
|
| 66 |
+
if __name__ == "__main__":
|
| 67 |
+
main()
|
app.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
title: Advanced Face & Feature Detection App
|
| 2 |
+
emoji: 👤
|
| 3 |
+
colorFrom: blue
|
| 4 |
+
colorTo: indigo
|
| 5 |
+
sdk: streamlit
|
| 6 |
+
sdk_version: 1.31.0
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
license: mit
|
packages.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
libgl1-mesa-glx
|
| 2 |
+
libglib2.0-0
|
| 3 |
+
libsm6
|
| 4 |
+
libxrender1
|
| 5 |
+
libxext6
|
| 6 |
+
libx11-6
|
| 7 |
+
libgtk-3-0
|
| 8 |
+
libatk1.0-0
|
| 9 |
+
libcairo2
|
| 10 |
+
ffmpeg
|
| 11 |
+
libavcodec-extra
|
| 12 |
+
cmake
|
requirements.txt
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit>=1.31.0
|
| 2 |
+
opencv-python-headless>=4.8.0
|
| 3 |
+
numpy>=1.26.0
|
| 4 |
+
Pillow>=10.0.0
|
| 5 |
+
scikit-learn>=1.0.0
|
| 6 |
+
matplotlib>=3.5.0
|
| 7 |
+
pandas>=1.3.0
|
| 8 |
+
deepface>=0.0.79
|
| 9 |
+
tensorflow>=2.8.0
|
| 10 |
+
scipy>=1.7.0
|
| 11 |
+
mtcnn>=0.1.0
|
| 12 |
+
retina-face>=0.0.1
|
| 13 |
+
requests>=2.25.0
|
| 14 |
+
dlib>=19.22.0
|
streamlit_app.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|