Rekham1110 commited on
Commit
497e47e
·
verified ·
1 Parent(s): d58d4db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -33
app.py CHANGED
@@ -80,7 +80,7 @@ def mock_ai_model(image):
80
  edge_ratio = edge_count / (width * height)
81
 
82
  # Final Completion criteria: high brightness, low variation, low edges (finished look)
83
- if brightness_avg > 230 and color_variation < 10 and edge_ratio < 0.03:
84
  return "Final Completion", 100, 0.95
85
 
86
  # Fallback to hash-based simulation
@@ -193,74 +193,56 @@ def process_image(images, project_name, project_type):
193
  except Exception as e:
194
  return f"<p style='color: red;'>Error: {str(e)}</p>", "Failure", "", "", "0%"
195
 
196
- # Gradio UI with updated styling
197
  with gr.Blocks(css="""
198
  .gradio-container {
199
- background-color: #f5f7fa;
200
  font-family: Arial, sans-serif;
201
- padding: 15px;
202
  }
203
  .title {
204
- color: #2e86ab;
205
- font-size: 26px;
206
  text-align: center;
207
  font-weight: bold;
208
- margin-bottom: 15px;
209
  }
210
  .gradio-row {
211
  text-align: center;
212
- margin-bottom: 10px;
213
  }
214
  .gradio-container .output {
215
- background-color: #ffffff;
216
- padding: 10px;
217
- border-radius: 6px;
218
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
219
- text-align: left;
220
- font-size: 15px;
221
  }
222
  .gradio-container .input {
223
  text-align: center;
224
- margin-bottom: 8px;
225
  }
226
  .gradio-container .button {
227
  display: block;
228
  margin: 0 auto;
229
- background: linear-gradient(to right, #4a90e2, #2e86ab);
230
  color: white;
231
  border: none;
232
  padding: 10px 20px;
233
- border-radius: 6px;
234
  cursor: pointer;
235
- font-size: 15px;
236
- transition: background 0.3s;
237
  }
238
  .gradio-container .button:hover {
239
- background: #2e86ab;
240
  }
241
  progress::-webkit-progress-value {
242
- background-color: #e74c3c;
243
- border-radius: 4px;
244
  }
245
  progress::-webkit-progress-bar {
246
  background-color: #ecf0f1;
247
- border-radius: 4px;
248
  }
249
  details summary {
250
  cursor: pointer;
251
- padding: 8px;
252
  background-color: #ecf0f1;
253
- border-radius: 4px;
254
- font-weight: bold;
255
- margin-bottom: 5px;
256
  }
257
  details ul {
258
- margin-top: 8px;
259
- padding-left: 18px;
260
- }
261
- .output strong {
262
- color: #2e86ab;
263
- font-weight: bold;
264
  }
265
  """) as demo:
266
  gr.Markdown("<h1 class='title'>Construction Progress Analyzer</h1>")
 
80
  edge_ratio = edge_count / (width * height)
81
 
82
  # Final Completion criteria: high brightness, low variation, low edges (finished look)
83
+ if brightness_avg > 220 and color_variation < 15 and edge_ratio < 0.05:
84
  return "Final Completion", 100, 0.95
85
 
86
  # Fallback to hash-based simulation
 
193
  except Exception as e:
194
  return f"<p style='color: red;'>Error: {str(e)}</p>", "Failure", "", "", "0%"
195
 
196
+ # Gradio UI with enhanced styling
197
  with gr.Blocks(css="""
198
  .gradio-container {
199
+ background-color: #f0f4f8;
200
  font-family: Arial, sans-serif;
 
201
  }
202
  .title {
203
+ color: #2c3e50;
204
+ font-size: 24px;
205
  text-align: center;
206
  font-weight: bold;
 
207
  }
208
  .gradio-row {
209
  text-align: center;
 
210
  }
211
  .gradio-container .output {
212
+ text-align: center;
 
 
 
 
 
213
  }
214
  .gradio-container .input {
215
  text-align: center;
 
216
  }
217
  .gradio-container .button {
218
  display: block;
219
  margin: 0 auto;
220
+ background-color: #3498db;
221
  color: white;
222
  border: none;
223
  padding: 10px 20px;
224
+ border-radius: 5px;
225
  cursor: pointer;
 
 
226
  }
227
  .gradio-container .button:hover {
228
+ background-color: #2980b9;
229
  }
230
  progress::-webkit-progress-value {
231
+ background-color: #2ecc71;
232
+ border-radius: 5px;
233
  }
234
  progress::-webkit-progress-bar {
235
  background-color: #ecf0f1;
236
+ border-radius: 5px;
237
  }
238
  details summary {
239
  cursor: pointer;
240
+ padding: 10px;
241
  background-color: #ecf0f1;
242
+ border-radius: 5px;
 
 
243
  }
244
  details ul {
245
+ margin-top: 10px;
 
 
 
 
 
246
  }
247
  """) as demo:
248
  gr.Markdown("<h1 class='title'>Construction Progress Analyzer</h1>")