Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ SALESFORCE_SECURITY_TOKEN = "53AWRskW9EjWUsSL5LU6nFTy3"
|
|
| 15 |
SALESFORCE_INSTANCE_URL = "https://sathikrutha-a-dev-ed.my.salesforce.com"
|
| 16 |
|
| 17 |
# Replace with a valid Site__c record ID from your Salesforce org
|
| 18 |
-
SITE_RECORD_ID = "
|
| 19 |
|
| 20 |
# Connect to Salesforce
|
| 21 |
try:
|
|
@@ -107,7 +107,7 @@ def detect_defects(image):
|
|
| 107 |
|
| 108 |
for i in range(len(predictions[0]['boxes'])):
|
| 109 |
score = predictions[0]['scores'][i].item()
|
| 110 |
-
if score < 0.
|
| 111 |
continue
|
| 112 |
|
| 113 |
box = predictions[0]['boxes'][i].tolist()
|
|
@@ -138,7 +138,9 @@ def detect_defects(image):
|
|
| 138 |
"Severity__c": output[0]["severity"],
|
| 139 |
"Fault_Summary__c": json.dumps(output),
|
| 140 |
"Inspection_Date__c": current_date,
|
| 141 |
-
"Status__c": "New"
|
|
|
|
|
|
|
| 142 |
})
|
| 143 |
|
| 144 |
record_id = inspection_record.get("id")
|
|
|
|
| 15 |
SALESFORCE_INSTANCE_URL = "https://sathikrutha-a-dev-ed.my.salesforce.com"
|
| 16 |
|
| 17 |
# Replace with a valid Site__c record ID from your Salesforce org
|
| 18 |
+
SITE_RECORD_ID = "a003000000xxxxx" # TODO: Update with actual ID from Site__c
|
| 19 |
|
| 20 |
# Connect to Salesforce
|
| 21 |
try:
|
|
|
|
| 107 |
|
| 108 |
for i in range(len(predictions[0]['boxes'])):
|
| 109 |
score = predictions[0]['scores'][i].item()
|
| 110 |
+
if score < 0.5: # Lowered threshold for testing
|
| 111 |
continue
|
| 112 |
|
| 113 |
box = predictions[0]['boxes'][i].tolist()
|
|
|
|
| 138 |
"Severity__c": output[0]["severity"],
|
| 139 |
"Fault_Summary__c": json.dumps(output),
|
| 140 |
"Inspection_Date__c": current_date,
|
| 141 |
+
"Status__c": "New",
|
| 142 |
+
"Annotated_Image_URL__c": "", # Will be updated
|
| 143 |
+
"Report_PDF__c": "" # Placeholder; update with actual PDF URL if available
|
| 144 |
})
|
| 145 |
|
| 146 |
record_id = inspection_record.get("id")
|