Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -4,10 +4,13 @@ import base64
|
|
| 4 |
import requests
|
| 5 |
import logging
|
| 6 |
from datetime import datetime
|
| 7 |
-
from deepface import DeepFace
|
| 8 |
-
from mtcnn import MTCNN
|
| 9 |
import os
|
| 10 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Configure logging
|
| 13 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
@@ -19,6 +22,10 @@ SALESFORCE_TOKEN = os.getenv("SALESFORCE_TOKEN", "your_salesforce_oauth_token")
|
|
| 19 |
SALESFORCE_BASE_URL = "https://construction-site.secure.force.com/WorkerRecognition/services/apexrest"
|
| 20 |
SALESFORCE_ENDPOINT = f"{SALESFORCE_BASE_URL}/ProcessImage"
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
class WorkerRecognitionSystem:
|
| 23 |
def __init__(self):
|
| 24 |
"""Initialize the face recognition system."""
|
|
|
|
| 4 |
import requests
|
| 5 |
import logging
|
| 6 |
from datetime import datetime
|
|
|
|
|
|
|
| 7 |
import os
|
| 8 |
from dotenv import load_dotenv
|
| 9 |
+
import warnings
|
| 10 |
+
|
| 11 |
+
# Suppress TensorFlow warnings
|
| 12 |
+
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
| 13 |
+
warnings.filterwarnings('ignore')
|
| 14 |
|
| 15 |
# Configure logging
|
| 16 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
| 22 |
SALESFORCE_BASE_URL = "https://construction-site.secure.force.com/WorkerRecognition/services/apexrest"
|
| 23 |
SALESFORCE_ENDPOINT = f"{SALESFORCE_BASE_URL}/ProcessImage"
|
| 24 |
|
| 25 |
+
# Import DeepFace after setting up environment
|
| 26 |
+
from deepface import DeepFace
|
| 27 |
+
from mtcnn import MTCNN
|
| 28 |
+
|
| 29 |
class WorkerRecognitionSystem:
|
| 30 |
def __init__(self):
|
| 31 |
"""Initialize the face recognition system."""
|