Spaces:
Sleeping
Sleeping
Update app.py
#1
by
Rekham1110
- opened
app.py
CHANGED
@@ -80,18 +80,16 @@ def process_image(images, project_name):
|
|
80 |
except Exception as e:
|
81 |
return f"Error: Failed to upload image to Salesforce - {str(e)}", "Failure", "", "", 0
|
82 |
|
83 |
-
#
|
84 |
-
|
85 |
-
|
86 |
-
milestone_index = img_hash % len(VALID_MILESTONES)
|
87 |
-
milestone = VALID_MILESTONES[milestone_index]
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
milestones.append(milestone)
|
97 |
|
|
|
80 |
except Exception as e:
|
81 |
return f"Error: Failed to upload image to Salesforce - {str(e)}", "Failure", "", "", 0
|
82 |
|
83 |
+
# Use file name to detect milestones as a fallback (simple keyword-based detection)
|
84 |
+
milestone = "Planning" # Default if no match is found
|
85 |
+
image_filename_lower = image_filename.lower()
|
|
|
|
|
86 |
|
87 |
+
if any(keyword in image_filename_lower for keyword in ["foundation", "excavation", "digging"]):
|
88 |
+
milestone = "Foundation"
|
89 |
+
elif any(keyword in image_filename_lower for keyword in ["walls", "framing", "structure"]):
|
90 |
+
milestone = "Walls Erected"
|
91 |
+
elif any(keyword in image_filename_lower for keyword in ["completed", "final", "finished"]):
|
92 |
+
milestone = "Completed"
|
93 |
|
94 |
milestones.append(milestone)
|
95 |
|