Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ local_timezone = pytz.timezone("Asia/Kolkata")
|
|
| 40 |
# Image processing and Salesforce upload
|
| 41 |
def process_image(images, project_name):
|
| 42 |
try:
|
| 43 |
-
if not images or
|
| 44 |
return "Error: Please upload at least one image to proceed.", "Pending", "", "", 0
|
| 45 |
|
| 46 |
# Process each image
|
|
@@ -87,9 +87,9 @@ def process_image(images, project_name):
|
|
| 87 |
milestone = VALID_MILESTONES[milestone_index]
|
| 88 |
|
| 89 |
# Adjust milestone detection based on internal/external features
|
| 90 |
-
if milestone == "Walls Erected" and any("interior" in img_text.lower() for img_text in [
|
| 91 |
# Check for visible internal works like electrical/plumbing
|
| 92 |
-
if any(keyword in str(
|
| 93 |
milestone = "Completed" # Upgrade to Completed if internal works are detected
|
| 94 |
else:
|
| 95 |
milestone = "Walls Erected" # Retain if no internal works visible
|
|
@@ -285,7 +285,7 @@ with gr.Blocks(css="""
|
|
| 285 |
""") as demo:
|
| 286 |
gr.Markdown("<h1 class='title'>Construction Progress Analyzer</h1>")
|
| 287 |
with gr.Row():
|
| 288 |
-
image_input = gr.
|
| 289 |
project_name_input = gr.Textbox(label="Project Name (Required)", placeholder="e.g. Project_12345")
|
| 290 |
|
| 291 |
submit_button = gr.Button("Process Image")
|
|
|
|
| 40 |
# Image processing and Salesforce upload
|
| 41 |
def process_image(images, project_name):
|
| 42 |
try:
|
| 43 |
+
if not images or len(images) == 0:
|
| 44 |
return "Error: Please upload at least one image to proceed.", "Pending", "", "", 0
|
| 45 |
|
| 46 |
# Process each image
|
|
|
|
| 87 |
milestone = VALID_MILESTONES[milestone_index]
|
| 88 |
|
| 89 |
# Adjust milestone detection based on internal/external features
|
| 90 |
+
if milestone == "Walls Erected" and any("interior" in img_text.lower() for img_text in [os.path.basename(image)] if img_text):
|
| 91 |
# Check for visible internal works like electrical/plumbing
|
| 92 |
+
if any(keyword in str(os.path.basename(image)).lower() for keyword in ["electrical", "plumbing", "wiring", "pipes"]):
|
| 93 |
milestone = "Completed" # Upgrade to Completed if internal works are detected
|
| 94 |
else:
|
| 95 |
milestone = "Walls Erected" # Retain if no internal works visible
|
|
|
|
| 285 |
""") as demo:
|
| 286 |
gr.Markdown("<h1 class='title'>Construction Progress Analyzer</h1>")
|
| 287 |
with gr.Row():
|
| 288 |
+
image_input = gr.Files(type="filepath", label="Upload Construction Site Photos (JPG/PNG, ≤ 20MB)")
|
| 289 |
project_name_input = gr.Textbox(label="Project Name (Required)", placeholder="e.g. Project_12345")
|
| 290 |
|
| 291 |
submit_button = gr.Button("Process Image")
|