Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,20 +7,20 @@ from email.mime.text import MIMEText
|
|
| 7 |
from email.mime.multipart import MIMEMultipart
|
| 8 |
|
| 9 |
# Salesforce credentials
|
| 10 |
-
USERNAME = '
|
| 11 |
-
PASSWORD = '
|
| 12 |
-
SECURITY_TOKEN = '
|
| 13 |
|
| 14 |
# Connect to Salesforce
|
| 15 |
sf = Salesforce(username=USERNAME, password=PASSWORD, security_token=SECURITY_TOKEN)
|
| 16 |
|
| 17 |
# Query records from two custom objects (with image fields)
|
| 18 |
-
custom_object_1 = '
|
| 19 |
-
custom_object_2 = '
|
| 20 |
|
| 21 |
# Replace with actual field names
|
| 22 |
-
query_1 = f"SELECT
|
| 23 |
-
query_2 = f"SELECT
|
| 24 |
|
| 25 |
# Retrieve records
|
| 26 |
records_custom_object_1 = sf.query(query_1)['records']
|
|
@@ -31,9 +31,9 @@ salesforce_records = records_custom_object_1 + records_custom_object_2
|
|
| 31 |
|
| 32 |
# Function to send an email if unknown face is found
|
| 33 |
def send_email(unknown_image_path):
|
| 34 |
-
sender_email = "
|
| 35 |
-
receiver_email = "
|
| 36 |
-
password = "
|
| 37 |
|
| 38 |
message = MIMEMultipart("alternative")
|
| 39 |
message["Subject"] = "Unknown Face Detected"
|
|
@@ -51,7 +51,7 @@ def send_email(unknown_image_path):
|
|
| 51 |
server.sendmail(sender_email, receiver_email, message.as_string())
|
| 52 |
|
| 53 |
# Folder with input images to match
|
| 54 |
-
input_folder = "
|
| 55 |
|
| 56 |
# Function to compare images and find matches
|
| 57 |
def compare_images(salesforce_records, input_folder):
|
|
|
|
| 7 |
from email.mime.multipart import MIMEMultipart
|
| 8 |
|
| 9 |
# Salesforce credentials
|
| 10 |
+
USERNAME = 'ajayalways411@gmail.com'
|
| 11 |
+
PASSWORD = 'Anusha@310819'
|
| 12 |
+
SECURITY_TOKEN = 'DcroeUKt0Lc4Lpqgzh9dMxEyQ'
|
| 13 |
|
| 14 |
# Connect to Salesforce
|
| 15 |
sf = Salesforce(username=USERNAME, password=PASSWORD, security_token=SECURITY_TOKEN)
|
| 16 |
|
| 17 |
# Query records from two custom objects (with image fields)
|
| 18 |
+
custom_object_1 = 'CustomerData__c'
|
| 19 |
+
custom_object_2 = 'staff__c'
|
| 20 |
|
| 21 |
# Replace with actual field names
|
| 22 |
+
query_1 = f"SELECT PhoneNumber__c, Name, AdhardCardPhoto__c FROM {custom_object_1}"
|
| 23 |
+
query_2 = f"SELECT contactNumber__c, Name, AdhardCard__c FROM {custom_object_2}"
|
| 24 |
|
| 25 |
# Retrieve records
|
| 26 |
records_custom_object_1 = sf.query(query_1)['records']
|
|
|
|
| 31 |
|
| 32 |
# Function to send an email if unknown face is found
|
| 33 |
def send_email(unknown_image_path):
|
| 34 |
+
sender_email = "aajayk999@gmail.com@gmail.com"
|
| 35 |
+
receiver_email = "ajayaklaram07@gmail.com"
|
| 36 |
+
password = "8008995817"
|
| 37 |
|
| 38 |
message = MIMEMultipart("alternative")
|
| 39 |
message["Subject"] = "Unknown Face Detected"
|
|
|
|
| 51 |
server.sendmail(sender_email, receiver_email, message.as_string())
|
| 52 |
|
| 53 |
# Folder with input images to match
|
| 54 |
+
input_folder = "C:\Users\nikit\OneDrive\Desktop\New folder (2)"
|
| 55 |
|
| 56 |
# Function to compare images and find matches
|
| 57 |
def compare_images(salesforce_records, input_folder):
|