capradeepgujaran commited on
Commit
3e10c7b
·
verified ·
1 Parent(s): 91132d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -38
app.py CHANGED
@@ -439,6 +439,22 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
439
  </div>
440
  """
441
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
 
443
  gr.HTML('<h3 class="section-title">Snag Detection Results</h3>')
444
  chatbot = gr.Chatbot(
@@ -469,48 +485,11 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
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:
489
- result = detect_snags(file)
490
- results.append((file.name, result))
491
- return results
492
-
493
- def update_chat(history, new_messages):
494
- history = history or []
495
- for title, content in new_messages:
496
- history.append((None, f"File: {title}\n\n{content}"))
497
- return history
498
-
499
- analyze_button.click(
500
- process_files,
501
- inputs=[file_input],
502
- outputs=[chatbot],
503
- postprocess=lambda x: update_chat(chatbot.value, x)
504
- )
505
-
506
- msg.submit(chat_about_snags, [msg, chatbot], [msg, chatbot])
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
- )
514
 
515
  # Launch the app
516
  if __name__ == "__main__":
 
439
  </div>
440
  """
441
  )
442
+
443
+ with gr.Row():
444
+ gr.HTML(
445
+ """
446
+ <div class="info-box" style="margin-bottom: 1rem;">
447
+ <h4>How to use:</h4>
448
+ <ol>
449
+ <li>Upload images or videos of your construction site</li>
450
+ <li>Click "Detect Snags" to analyze the files</li>
451
+ <li>Review the detected snags in the chat area</li>
452
+ <li>Ask follow-up questions about the snags or request more information</li>
453
+ <li>Download a comprehensive report for your records</li>
454
+ </ol>
455
+ </div>
456
+ """
457
+ )
458
 
459
  gr.HTML('<h3 class="section-title">Snag Detection Results</h3>')
460
  chatbot = gr.Chatbot(
 
485
  <div class="groq-badge">Powered by Groq</div>
486
  <div class="model-info">Model: llama-3.2-90b-vision-preview</div>
487
  </div>
 
 
 
 
 
 
 
 
 
 
488
  </div>
489
  """
490
  )
491
 
492
+ # (The rest of the code, including function definitions and event handlers, remains the same)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
493
 
494
  # Launch the app
495
  if __name__ == "__main__":