Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,17 +37,8 @@ def mock_ai_model(image):
|
|
| 37 |
|
| 38 |
# Feature Extraction and Milestone Detection (simulated)
|
| 39 |
# In a real scenario, this would use a CNN model trained on construction images
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
"Structural Framework Started",
|
| 43 |
-
"Walls In Progress",
|
| 44 |
-
"Roofing Started",
|
| 45 |
-
"Interior Work Started",
|
| 46 |
-
"Project Completed"
|
| 47 |
-
]
|
| 48 |
-
|
| 49 |
-
# For this image, based on the concrete pillars and rebar, we assume "Structural Framework Started"
|
| 50 |
-
milestone = "Structural Framework Started"
|
| 51 |
completion_percent = 30 # Estimated based on the image
|
| 52 |
confidence_score = round(random.uniform(0.85, 0.95), 2) # Random confidence between 85-95%
|
| 53 |
|
|
@@ -78,7 +69,7 @@ def process_image(image):
|
|
| 78 |
|
| 79 |
# Store result in Salesforce
|
| 80 |
record = {
|
| 81 |
-
"Name__c": unique_id, # Use a timestamp-based unique ID
|
| 82 |
"Current_Milestone__c": milestone,
|
| 83 |
"Completion_Percentage__c": percent_complete,
|
| 84 |
"Last_Updated_On__c": datetime.now().isoformat(),
|
|
|
|
| 37 |
|
| 38 |
# Feature Extraction and Milestone Detection (simulated)
|
| 39 |
# In a real scenario, this would use a CNN model trained on construction images
|
| 40 |
+
# Using a generic milestone value that is likely to be in a Salesforce picklist
|
| 41 |
+
milestone = "In Progress" # Changed to a more generic value to avoid picklist error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
completion_percent = 30 # Estimated based on the image
|
| 43 |
confidence_score = round(random.uniform(0.85, 0.95), 2) # Random confidence between 85-95%
|
| 44 |
|
|
|
|
| 69 |
|
| 70 |
# Store result in Salesforce
|
| 71 |
record = {
|
| 72 |
+
"Name__c": unique_id, # Use a timestamp-based unique ID
|
| 73 |
"Current_Milestone__c": milestone,
|
| 74 |
"Completion_Percentage__c": percent_complete,
|
| 75 |
"Last_Updated_On__c": datetime.now().isoformat(),
|