capradeepgujaran commited on
Commit
a0b0991
·
verified ·
1 Parent(s): a9a0441

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -22
app.py CHANGED
@@ -273,6 +273,19 @@ body {
273
  text-align: center;
274
  }
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  .file-upload-container {
277
  border: 2px dashed var(--primary-color);
278
  border-radius: 10px;
@@ -350,7 +363,7 @@ body {
350
  margin-bottom: 0.5rem;
351
  }
352
 
353
- .info-box ul {
354
  margin: 0;
355
  padding-left: 1.5rem;
356
  }
@@ -366,14 +379,17 @@ body {
366
  margin-bottom: 0.5rem;
367
  }
368
 
 
 
 
 
369
  .footer {
370
  margin-top: 2rem;
371
  padding-top: 1rem;
372
  border-top: 2px solid var(--primary-color);
373
  display: flex;
374
- justify-content: space-between;
375
  align-items: center;
376
- flex-wrap: wrap;
377
  }
378
 
379
  .groq-badge {
@@ -384,12 +400,12 @@ body {
384
  font-weight: bold;
385
  font-size: 1rem;
386
  display: inline-block;
 
387
  }
388
 
389
  .model-info {
390
  color: var(--text-color);
391
  font-size: 0.9rem;
392
- margin-top: 0.5rem;
393
  }
394
  """
395
 
@@ -405,8 +421,8 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
405
  """
406
  )
407
 
408
- with gr.Row():
409
- with gr.Column(scale=2):
410
  gr.HTML('<h3 class="section-title">Upload Files</h3>')
411
  file_input = gr.File(
412
  label="Upload Construction Site Images or Videos",
@@ -414,9 +430,26 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
414
  type="filepath",
415
  elem_classes="file-upload-container"
416
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  analyze_button = gr.Button("🔍 Detect Snags", elem_classes="analyze-button")
418
 
419
- with gr.Column(scale=1):
420
  gr.HTML(
421
  """
422
  <div class="info-box">
@@ -465,24 +498,24 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
465
  gr.HTML(
466
  """
467
  <div class="footer">
468
- <div>
469
- <div class="groq-badge">Powered by Groq</div>
470
- <div class="model-info">Model: llama-3.2-90b-vision-preview</div>
471
- </div>
472
- <div class="info-box" style="margin-bottom: 0;">
473
- <h4>How to use:</h4>
474
- <ol>
475
- <li>Upload images or videos of your construction site</li>
476
- <li>Click "Detect Snags" to analyze the files</li>
477
- <li>Review the detected snags in the chat area</li>
478
- <li>Ask follow-up questions about the snags or request more information</li>
479
- <li>Download a comprehensive report for your records</li>
480
- </ol>
481
- </div>
482
  </div>
483
  """
484
  )
485
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  def process_files(files):
487
  results = []
488
  for file in files:
@@ -507,7 +540,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
507
  clear.click(lambda: None, None, chatbot, queue=False)
508
 
509
  download_button.click(
510
- download_snag_report,
511
  inputs=[chatbot],
512
  outputs=[report_file]
513
  )
 
273
  text-align: center;
274
  }
275
 
276
+ .main-content {
277
+ display: flex;
278
+ gap: 2rem;
279
+ }
280
+
281
+ .left-column {
282
+ flex: 2;
283
+ }
284
+
285
+ .right-column {
286
+ flex: 1;
287
+ }
288
+
289
  .file-upload-container {
290
  border: 2px dashed var(--primary-color);
291
  border-radius: 10px;
 
363
  margin-bottom: 0.5rem;
364
  }
365
 
366
+ .info-box ul, .info-box ol {
367
  margin: 0;
368
  padding-left: 1.5rem;
369
  }
 
379
  margin-bottom: 0.5rem;
380
  }
381
 
382
+ .how-to-use {
383
+ margin-top: 1rem;
384
+ }
385
+
386
  .footer {
387
  margin-top: 2rem;
388
  padding-top: 1rem;
389
  border-top: 2px solid var(--primary-color);
390
  display: flex;
391
+ justify-content: flex-start;
392
  align-items: center;
 
393
  }
394
 
395
  .groq-badge {
 
400
  font-weight: bold;
401
  font-size: 1rem;
402
  display: inline-block;
403
+ margin-right: 1rem;
404
  }
405
 
406
  .model-info {
407
  color: var(--text-color);
408
  font-size: 0.9rem;
 
409
  }
410
  """
411
 
 
421
  """
422
  )
423
 
424
+ with gr.Row(elem_classes="main-content"):
425
+ with gr.Column(elem_classes="left-column"):
426
  gr.HTML('<h3 class="section-title">Upload Files</h3>')
427
  file_input = gr.File(
428
  label="Upload Construction Site Images or Videos",
 
430
  type="filepath",
431
  elem_classes="file-upload-container"
432
  )
433
+
434
+ with gr.Row(elem_classes="how-to-use"):
435
+ gr.HTML(
436
+ """
437
+ <div class="info-box">
438
+ <h4>How to use:</h4>
439
+ <ol>
440
+ <li>Upload images or videos of your construction site</li>
441
+ <li>Click "Detect Snags" to analyze the files</li>
442
+ <li>Review the detected snags in the chat area</li>
443
+ <li>Ask follow-up questions about the snags or request more information</li>
444
+ <li>Download a comprehensive report for your records</li>
445
+ </ol>
446
+ </div>
447
+ """
448
+ )
449
+
450
  analyze_button = gr.Button("🔍 Detect Snags", elem_classes="analyze-button")
451
 
452
+ with gr.Column(elem_classes="right-column"):
453
  gr.HTML(
454
  """
455
  <div class="info-box">
 
498
  gr.HTML(
499
  """
500
  <div class="footer">
501
+ <div class="groq-badge">Powered by Groq</div>
502
+ <div class="model-info">Model: llama-3.2-90b-vision-preview</div>
 
 
 
 
 
 
 
 
 
 
 
 
503
  </div>
504
  """
505
  )
506
 
507
+ def detect_snags(file):
508
+ # Implement snag detection logic here
509
+ pass
510
+
511
+ def chat_about_snags(message, chat_history):
512
+ # Implement chat functionality here
513
+ pass
514
+
515
+ def generate_snag_report(chat_history):
516
+ # Implement report generation logic here
517
+ pass
518
+
519
  def process_files(files):
520
  results = []
521
  for file in files:
 
540
  clear.click(lambda: None, None, chatbot, queue=False)
541
 
542
  download_button.click(
543
+ generate_snag_report,
544
  inputs=[chatbot],
545
  outputs=[report_file]
546
  )