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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -9
app.py CHANGED
@@ -179,10 +179,13 @@ def process_image(images, project_name, project_type):
179
  except Exception as e:
180
  return f"<p style='color: red;'>Error: Failed to update Salesforce - {str(e)}</p>", "Failure", "", "", 0
181
 
182
- output_html = "<div style='text-align: left;'>"
183
  output_html += "<h3>Processing Results:</h3><ul>"
184
  for result in results:
185
- output_html += f"<li>{result}</li>"
 
 
 
186
  output_html += "</ul>"
187
  output_html += f"<p><strong>Project Record Created:</strong> {project_name} (Total: {total_percent_complete}%)</p>"
188
  output_html += f"<p><strong>Note:</strong> Only the image with the highest completion percentage is stored in Salesforce due to field length constraints.</p>"
@@ -204,29 +207,63 @@ with gr.Blocks(css="""
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;
@@ -237,7 +274,7 @@ with gr.Blocks(css="""
237
  }
238
  details summary {
239
  cursor: pointer;
240
- padding: 10px;
241
  background-color: #ecf0f1;
242
  border-radius: 5px;
243
  }
@@ -273,4 +310,4 @@ try:
273
  time.sleep(10)
274
  except Exception as e:
275
  print(f"Failed to launch Gradio interface: {str(e)}")
276
- raise
 
179
  except Exception as e:
180
  return f"<p style='color: red;'>Error: Failed to update Salesforce - {str(e)}</p>", "Failure", "", "", 0
181
 
182
+ output_html = "<div class='output'>"
183
  output_html += "<h3>Processing Results:</h3><ul>"
184
  for result in results:
185
+ if 'Error' in result:
186
+ output_html += f"<li class='error'>{result}</li>"
187
+ else:
188
+ output_html += f"<li class='success'>{result}</li>"
189
  output_html += "</ul>"
190
  output_html += f"<p><strong>Project Record Created:</strong> {project_name} (Total: {total_percent_complete}%)</p>"
191
  output_html += f"<p><strong>Note:</strong> Only the image with the highest completion percentage is stored in Salesforce due to field length constraints.</p>"
 
207
  font-size: 24px;
208
  text-align: center;
209
  font-weight: bold;
210
+ margin-bottom: 20px;
211
  }
212
  .gradio-row {
213
  text-align: center;
214
  }
215
  .gradio-container .output {
216
+ text-align: left;
217
+ margin-top: 20px;
218
+ padding: 20px;
219
+ background-color: #ffffff;
220
+ border-radius: 8px;
221
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
222
+ max-width: 800px;
223
+ margin-left: auto;
224
+ margin-right: auto;
225
  }
226
+ .gradio-container .output h3 {
227
+ color: #2c3e50;
228
+ font-size: 20px;
229
+ font-weight: bold;
230
+ margin-bottom: 15px;
231
+ }
232
+ .gradio-container .output ul {
233
+ list-style-type: none;
234
+ padding: 0;
235
+ }
236
+ .gradio-container .output li {
237
+ padding: 10px;
238
+ margin-bottom: 10px;
239
+ background-color: #ecf0f1;
240
+ border-radius: 5px;
241
+ font-size: 14px;
242
+ }
243
+ .gradio-container .output li.success {
244
+ background-color: #2ecc71;
245
+ color: white;
246
+ }
247
+ .gradio-container .output li.error {
248
+ background-color: #e74c3c;
249
+ color: white;
250
  }
251
  .gradio-container .button {
252
  display: block;
253
+ margin: 20px auto;
254
  background-color: #3498db;
255
  color: white;
256
  border: none;
257
+ padding: 12px 24px;
258
  border-radius: 5px;
259
  cursor: pointer;
260
  }
261
  .gradio-container .button:hover {
262
  background-color: #2980b9;
263
  }
264
+ .gradio-container .input {
265
+ text-align: center;
266
+ }
267
  progress::-webkit-progress-value {
268
  background-color: #2ecc71;
269
  border-radius: 5px;
 
274
  }
275
  details summary {
276
  cursor: pointer;
277
+ padding: 12px;
278
  background-color: #ecf0f1;
279
  border-radius: 5px;
280
  }
 
310
  time.sleep(10)
311
  except Exception as e:
312
  print(f"Failed to launch Gradio interface: {str(e)}")
313
+ raise