Spaces:
Running
Running
Commit
·
03ae406
1
Parent(s):
280df10
Solución completa: Forzar TensorFlow 2.12.0 y Keras 2.12.0 compatibles
Browse files- .hugginface +14 -0
- app.py +4 -53
- force_update.txt +2 -0
- packages.txt +1 -4
- requirements.txt +14 -15
- runtime.txt +1 -0
.hugginface
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
build_env:
|
| 2 |
+
cuda: "11.8"
|
| 3 |
+
python: "3.10"
|
| 4 |
+
system:
|
| 5 |
+
packages:
|
| 6 |
+
- "libgl1-mesa-glx"
|
| 7 |
+
- "libglib2.0-0"
|
| 8 |
+
- "libsm6"
|
| 9 |
+
- "libxrender1"
|
| 10 |
+
- "libxext6"
|
| 11 |
+
- "libx11-6"
|
| 12 |
+
- "libcairo2"
|
| 13 |
+
- "ffmpeg"
|
| 14 |
+
- "cmake"
|
app.py
CHANGED
|
@@ -1,60 +1,11 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
import streamlit as st
|
| 7 |
-
except ImportError:
|
| 8 |
-
print("Error: No se pudo importar streamlit. Instalando...")
|
| 9 |
-
os.system("pip install streamlit>=1.31.0")
|
| 10 |
-
import streamlit as st
|
| 11 |
-
|
| 12 |
-
# Configura variables de entorno para TensorFlow
|
| 13 |
-
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Reducir mensajes de TensorFlow
|
| 14 |
-
os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # Forzar CPU para evitar problemas con GPU en entornos cloud
|
| 15 |
-
|
| 16 |
-
# Configura mensaje de error personalizado para dlib
|
| 17 |
-
try:
|
| 18 |
-
import dlib
|
| 19 |
-
DLIB_AVAILABLE = True
|
| 20 |
-
except ImportError:
|
| 21 |
-
DLIB_AVAILABLE = False
|
| 22 |
-
print("Warning: dlib no está disponible. Algunas funciones pueden estar limitadas.")
|
| 23 |
-
|
| 24 |
-
# Verificar TensorFlow y configurar ambiente
|
| 25 |
-
try:
|
| 26 |
-
import tensorflow as tf
|
| 27 |
-
tf_version = tf.__version__
|
| 28 |
-
print(f"TensorFlow version: {tf_version}")
|
| 29 |
-
except Exception as e:
|
| 30 |
-
print(f"Warning: TensorFlow initialization error: {e}")
|
| 31 |
-
|
| 32 |
-
# Aplicar parches para DeepFace y RetinaFace
|
| 33 |
-
try:
|
| 34 |
-
# Intenta importar y aplicar parches
|
| 35 |
-
import deepface_patch
|
| 36 |
-
deepface_patch.apply_patches()
|
| 37 |
-
except Exception as e:
|
| 38 |
-
print(f"Warning: Failed to apply patches: {e}")
|
| 39 |
-
|
| 40 |
-
# Asegurar que los archivos necesarios estén disponibles
|
| 41 |
-
required_model_files = [
|
| 42 |
-
"deploy.prototxt",
|
| 43 |
-
"res10_300x300_ssd_iter_140000.caffemodel",
|
| 44 |
-
"shape_predictor_68_face_landmarks.dat"
|
| 45 |
-
]
|
| 46 |
-
|
| 47 |
-
for model_file in required_model_files:
|
| 48 |
-
if not os.path.exists(model_file):
|
| 49 |
-
print(f"Note: {model_file} will be downloaded automatically when needed")
|
| 50 |
-
|
| 51 |
-
# Importa la aplicación principal
|
| 52 |
from streamlit_app import main
|
| 53 |
|
| 54 |
if __name__ == "__main__":
|
| 55 |
-
# Imprime información del sistema para debugging
|
| 56 |
-
print(f"Python version: {sys.version}")
|
| 57 |
-
print(f"DLIB available: {DLIB_AVAILABLE}")
|
| 58 |
-
|
| 59 |
-
# Ejecuta la aplicación principal
|
| 60 |
main()
|
|
|
|
| 1 |
+
# Simple app.py for Face Detection - compatible with TF 2.12.0
|
| 2 |
import os
|
| 3 |
import sys
|
| 4 |
+
import streamlit as st
|
| 5 |
|
| 6 |
+
# Importar la aplicación principal
|
| 7 |
+
print("Starting Face Detection Application...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from streamlit_app import main
|
| 9 |
|
| 10 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
main()
|
force_update.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Force update with compatible TensorFlow 2.12.0 and Keras 2.12.0
|
| 2 |
+
Updated: 2025-03-17
|
packages.txt
CHANGED
|
@@ -6,7 +6,4 @@ libxext6
|
|
| 6 |
libx11-6
|
| 7 |
libcairo2
|
| 8 |
ffmpeg
|
| 9 |
-
cmake
|
| 10 |
-
libatk1.0-0
|
| 11 |
-
libatk-bridge2.0-0
|
| 12 |
-
libhdf5-dev
|
|
|
|
| 6 |
libx11-6
|
| 7 |
libcairo2
|
| 8 |
ffmpeg
|
| 9 |
+
cmake
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
-
streamlit
|
| 2 |
-
opencv-python-headless
|
| 3 |
-
numpy
|
| 4 |
-
Pillow
|
| 5 |
-
scikit-learn
|
| 6 |
-
matplotlib
|
| 7 |
-
pandas
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
dlib-binary>=19.22.0
|
|
|
|
| 1 |
+
streamlit==1.31.0
|
| 2 |
+
opencv-python-headless==4.8.0
|
| 3 |
+
numpy==1.24.3
|
| 4 |
+
Pillow==10.0.0
|
| 5 |
+
scikit-learn==1.0.2
|
| 6 |
+
matplotlib==3.7.2
|
| 7 |
+
pandas==2.0.3
|
| 8 |
+
tensorflow==2.12.0
|
| 9 |
+
keras==2.12.0
|
| 10 |
+
scipy==1.11.3
|
| 11 |
+
mtcnn==0.1.1
|
| 12 |
+
retina-face==0.0.12
|
| 13 |
+
requests==2.31.0
|
| 14 |
+
dlib-binary==19.24.2
|
|
|
runtime.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
python-3.10
|