Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,12 +137,21 @@ def send_to_salesforce(violations, score):
|
|
| 137 |
violations_details = "\n".join([f"Frame {v['frame']}: {v['violation']} (Confidence: {v['confidence']})" for v in violations])
|
| 138 |
|
| 139 |
# Prepare the data payload to update Salesforce record
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
data = {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
'Compliance_Score__c': score,
|
| 142 |
'Violations_Found__c': len(violations),
|
| 143 |
-
'Violations_Details__c':
|
| 144 |
-
'Status__c': 'Reviewed', # Set to 'Reviewed' after processing
|
| 145 |
-
# 'PDF_Report_URL__c': pdf_url (If you generate and store a PDF URL)
|
| 146 |
}
|
| 147 |
|
| 148 |
try:
|
|
|
|
| 137 |
violations_details = "\n".join([f"Frame {v['frame']}: {v['violation']} (Confidence: {v['confidence']})" for v in violations])
|
| 138 |
|
| 139 |
# Prepare the data payload to update Salesforce record
|
| 140 |
+
#data = {
|
| 141 |
+
#'Compliance_Score__c': score,
|
| 142 |
+
# 'Violations_Found__c': len(violations),
|
| 143 |
+
# 'Violations_Details__c': violations_details,
|
| 144 |
+
#'Status__c': 'Reviewed', # Set to 'Reviewed' after processing
|
| 145 |
+
# 'PDF_Report_URL__c': pdf_url (If you generate and store a PDF URL)
|
| 146 |
+
#}
|
| 147 |
data = {
|
| 148 |
+
'Site__c': 'Sample Site', # You can replace with dynamic data or capture from user input
|
| 149 |
+
'Uploaded_By__c': 'User_1', # Example: Replace with actual user details
|
| 150 |
+
'Upload_Date__c': '2025-05-08T12:00:00Z', # Replace with actual upload date
|
| 151 |
+
'Status__c': 'Reviewed',
|
| 152 |
'Compliance_Score__c': score,
|
| 153 |
'Violations_Found__c': len(violations),
|
| 154 |
+
'Violations_Details__c': "\n".join([f"Frame {v['frame']}: {v['violation']} (Confidence: {v['confidence']})" for v in violations]),
|
|
|
|
|
|
|
| 155 |
}
|
| 156 |
|
| 157 |
try:
|