chandra7799 commited on
Commit
6e86a94
·
verified ·
1 Parent(s): d1970ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -15
app.py CHANGED
@@ -110,26 +110,42 @@ def process_image(image, project_name):
110
  # Detailed Completion Breakdown (based on detected milestone)
111
  completion_details = {
112
  "Planning": {
113
- "completed": "Project outline and goals set, initial designs done.",
114
- "not_completed": "Detailed plans, permits, and contractor hiring pending."
 
 
 
 
115
  },
116
  "Foundation": {
117
- "completed": "Foundation work is complete, concrete is poured.",
118
- "not_completed": "Plumbing, electrical groundwork not yet done."
 
 
 
 
119
  },
120
  "Walls Erected": {
121
- "completed": "All structural walls are up.",
122
- "not_completed": "Roofing, windows, and internal walls are not yet finished."
 
 
 
 
123
  },
124
  "Completed": {
125
- "completed": "All phases of the project are finished, including final touches.",
126
- "not_completed": "There should be no more pending work."
 
 
 
 
127
  }
128
  }
129
 
130
  # Get the detailed completion information based on the detected milestone
131
- completed_work = completion_details[milestone]["completed"]
132
- not_completed_work = completion_details[milestone]["not_completed"]
133
 
134
  # Adjust the current time to local timezone
135
  local_time = datetime.now(local_timezone).strftime("%Y-%m-%dT%H:%M:%S%z") # Corrected ISO 8601 format with timezone
@@ -151,15 +167,14 @@ def process_image(image, project_name):
151
  except Exception as e:
152
  return f"Error: Failed to update Salesforce - {str(e)}", "Failure", "", "", 0
153
 
154
- # Return the detailed result
155
  result = f"""
156
- Milestone: {milestone}
157
- Completion Percentage: {percent_complete}%
158
 
159
- **Completed Work**:
160
  {completed_work}
161
 
162
- **Not Completed Work**:
 
163
  {not_completed_work}
164
 
165
  Confidence Score: {confidence_score * 100}%
 
110
  # Detailed Completion Breakdown (based on detected milestone)
111
  completion_details = {
112
  "Planning": {
113
+ "completed": [
114
+ "Project outline and goals set, initial designs done."
115
+ ],
116
+ "not_completed": [
117
+ "Detailed plans, permits, and contractor hiring pending."
118
+ ]
119
  },
120
  "Foundation": {
121
+ "completed": [
122
+ "Foundation work is complete, concrete is poured."
123
+ ],
124
+ "not_completed": [
125
+ "Plumbing, electrical groundwork not yet done."
126
+ ]
127
  },
128
  "Walls Erected": {
129
+ "completed": [
130
+ "All structural walls are up."
131
+ ],
132
+ "not_completed": [
133
+ "Roofing, windows, and internal walls are not yet finished."
134
+ ]
135
  },
136
  "Completed": {
137
+ "completed": [
138
+ "All phases of the project are finished, including final touches."
139
+ ],
140
+ "not_completed": [
141
+ "There should be no more pending work."
142
+ ]
143
  }
144
  }
145
 
146
  # Get the detailed completion information based on the detected milestone
147
+ completed_work = "\n".join([f"{idx+1}. {task}" for idx, task in enumerate(completion_details[milestone]["completed"])])
148
+ not_completed_work = "\n".join([f"{idx+1}. {task}" for idx, task in enumerate(completion_details[milestone]["not_completed"])])
149
 
150
  # Adjust the current time to local timezone
151
  local_time = datetime.now(local_timezone).strftime("%Y-%m-%dT%H:%M:%S%z") # Corrected ISO 8601 format with timezone
 
167
  except Exception as e:
168
  return f"Error: Failed to update Salesforce - {str(e)}", "Failure", "", "", 0
169
 
170
+ # Return the detailed result in the desired format
171
  result = f"""
172
+ Completed:
 
173
 
 
174
  {completed_work}
175
 
176
+ Not Completed:
177
+
178
  {not_completed_work}
179
 
180
  Confidence Score: {confidence_score * 100}%