Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,15 +140,15 @@ def detect_defects(image):
|
|
| 140 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 141 |
inspection_name = f"Inspection-{current_date}-{len(output):03d}"
|
| 142 |
|
|
|
|
| 143 |
inspection_record = sf.Drone_Structure_Inspection__c.create({
|
| 144 |
-
"Site__c": SITE_RECORD_ID,
|
| 145 |
-
"Fault_Type__c": output[0]["type"],
|
| 146 |
-
"Severity__c": output[0]["severity"],
|
| 147 |
-
"Fault_Summary__c": json.dumps(output),
|
| 148 |
"Inspection_Date__c": current_date,
|
| 149 |
-
"
|
| 150 |
-
"
|
| 151 |
-
"
|
|
|
|
|
|
|
|
|
|
| 152 |
})
|
| 153 |
|
| 154 |
record_id = inspection_record.get("id")
|
|
|
|
| 140 |
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 141 |
inspection_name = f"Inspection-{current_date}-{len(output):03d}"
|
| 142 |
|
| 143 |
+
# Creating the Salesforce record with updated fields
|
| 144 |
inspection_record = sf.Drone_Structure_Inspection__c.create({
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
"Inspection_Date__c": current_date,
|
| 146 |
+
"Fault_Type__c": output[0]["type"], # Mapping defect type
|
| 147 |
+
"Severity__c": output[0]["severity"], # Mapping severity
|
| 148 |
+
"Fault_Summary__c": json.dumps(output), # Summarizing the defects
|
| 149 |
+
"Status__c": "New", # Default status
|
| 150 |
+
"Annotated_Image_URL__c": "", # Placeholder for image URL
|
| 151 |
+
"Report_PDF__c": "" # Placeholder for report PDF URL
|
| 152 |
})
|
| 153 |
|
| 154 |
record_id = inspection_record.get("id")
|