Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,8 +31,8 @@ except Exception as e:
|
|
| 31 |
print(f"Salesforce connection failed: {str(e)}")
|
| 32 |
raise
|
| 33 |
|
| 34 |
-
# Valid milestones
|
| 35 |
-
VALID_MILESTONES = ["Planning", "Foundation", "Walls Erected", "Completed"]
|
| 36 |
|
| 37 |
# Adjust the timezone to your local timezone
|
| 38 |
local_timezone = pytz.timezone("Asia/Kolkata")
|
|
@@ -92,6 +92,7 @@ def process_image(images, project_name):
|
|
| 92 |
"Planning": 10,
|
| 93 |
"Foundation": 30,
|
| 94 |
"Walls Erected": 50,
|
|
|
|
| 95 |
"Completed": 100,
|
| 96 |
}
|
| 97 |
percent_complete = milestone_completion_map.get(final_milestone, 0)
|
|
@@ -135,6 +136,18 @@ def process_image(images, project_name):
|
|
| 135 |
"Interior walls, electrical, and plumbing systems are still to be implemented."
|
| 136 |
]
|
| 137 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
"Completed": {
|
| 139 |
"completed": [
|
| 140 |
"The concrete framework, including columns, beams, and floor slabs, is fully constructed.",
|
|
@@ -175,6 +188,7 @@ def process_image(images, project_name):
|
|
| 175 |
<span style="color: {'#2ecc71' if final_milestone == 'Planning' else '#bdc3c7'};">Planning</span>
|
| 176 |
<span style="color: {'#2ecc71' if final_milestone == 'Foundation' else '#bdc3c7'};">Foundation</span>
|
| 177 |
<span style="color: {'#2ecc71' if final_milestone == 'Walls Erected' else '#bdc3c7'};">Walls Erected</span>
|
|
|
|
| 178 |
<span style="color: {'#2ecc71' if final_milestone == 'Completed' else '#bdc3c7'};">Completed</span>
|
| 179 |
</div>
|
| 180 |
|
|
@@ -227,6 +241,8 @@ def detect_milestone(image_path):
|
|
| 227 |
return "Foundation"
|
| 228 |
elif "walls" in image_name or "erected" in image_name:
|
| 229 |
return "Walls Erected"
|
|
|
|
|
|
|
| 230 |
elif "completed" in image_name:
|
| 231 |
return "Completed"
|
| 232 |
|
|
|
|
| 31 |
print(f"Salesforce connection failed: {str(e)}")
|
| 32 |
raise
|
| 33 |
|
| 34 |
+
# Valid milestones with the updated percentage map
|
| 35 |
+
VALID_MILESTONES = ["Planning", "Foundation", "Walls Erected", "Interior Furnishing", "Completed"]
|
| 36 |
|
| 37 |
# Adjust the timezone to your local timezone
|
| 38 |
local_timezone = pytz.timezone("Asia/Kolkata")
|
|
|
|
| 92 |
"Planning": 10,
|
| 93 |
"Foundation": 30,
|
| 94 |
"Walls Erected": 50,
|
| 95 |
+
"Interior Furnishing": 80,
|
| 96 |
"Completed": 100,
|
| 97 |
}
|
| 98 |
percent_complete = milestone_completion_map.get(final_milestone, 0)
|
|
|
|
| 136 |
"Interior walls, electrical, and plumbing systems are still to be implemented."
|
| 137 |
]
|
| 138 |
},
|
| 139 |
+
"Interior Furnishing": {
|
| 140 |
+
"completed": [
|
| 141 |
+
"Interior walls are fully constructed and painted.",
|
| 142 |
+
"Windows, doors, and roofing are complete.",
|
| 143 |
+
"HVAC, electrical, and plumbing are fully installed.",
|
| 144 |
+
"Flooring, fixtures, and finishes are nearing completion."
|
| 145 |
+
],
|
| 146 |
+
"not_completed": [
|
| 147 |
+
"Furniture installation and final touches are pending.",
|
| 148 |
+
"Final inspection and approval from authorities are yet to be completed."
|
| 149 |
+
]
|
| 150 |
+
},
|
| 151 |
"Completed": {
|
| 152 |
"completed": [
|
| 153 |
"The concrete framework, including columns, beams, and floor slabs, is fully constructed.",
|
|
|
|
| 188 |
<span style="color: {'#2ecc71' if final_milestone == 'Planning' else '#bdc3c7'};">Planning</span>
|
| 189 |
<span style="color: {'#2ecc71' if final_milestone == 'Foundation' else '#bdc3c7'};">Foundation</span>
|
| 190 |
<span style="color: {'#2ecc71' if final_milestone == 'Walls Erected' else '#bdc3c7'};">Walls Erected</span>
|
| 191 |
+
<span style="color: {'#2ecc71' if final_milestone == 'Interior Furnishing' else '#bdc3c7'};">Interior Furnishing</span>
|
| 192 |
<span style="color: {'#2ecc71' if final_milestone == 'Completed' else '#bdc3c7'};">Completed</span>
|
| 193 |
</div>
|
| 194 |
|
|
|
|
| 241 |
return "Foundation"
|
| 242 |
elif "walls" in image_name or "erected" in image_name:
|
| 243 |
return "Walls Erected"
|
| 244 |
+
elif "interior" in image_name or "furnishing" in image_name:
|
| 245 |
+
return "Interior Furnishing"
|
| 246 |
elif "completed" in image_name:
|
| 247 |
return "Completed"
|
| 248 |
|