Spaces:
Runtime error
Runtime error
Update app.py
Browse files41 unmodified lines424344454647484945505152532 unmodified lines565758545559605761626364656641 unmodified lines transforms.ToTensor(),])
# Define valid picklist values for Fault_Type__c and Severity__c# Replace these with your actual Salesforce picklist valuesVALID_FAULT_TYPES = ["Crack", "Rust", "Spalling", "Deformation", "Corrosion"]VALID_SEVERITIES = ["Minor", "Moderate", "Critical"]
# Map confidence score to severity level# Map confidence score to severity level ensuring valid picklist valuesdef get_severity(score): if score >= 0.9: return "Critical"2 unmodified lines else: return "Minor"
# Simple defect type mapping (no COCO labels)# Here, just return a generic "Defect" label or you can customize per your need# Map defect to a valid picklist fault typedef map_defect_type(): return "Defect" # You can add logic here to decide which fault type to return # For now, always return the first valid fault type return VALID_FAULT_TYPES[0]
# Upload annotated image to Salesforce as ContentVersion recorddef upload_image_to_salesforce(image, filename="detected_image.jpg", record_id=None):app.py+10-4