license: mit
title: Construction Site Safety Analyzer
sdk: gradio
emoji: π’
colorFrom: green
colorTo: blue
short_description: AI Tool to enhance safety compliance
sdk_version: 5.1.0
ποΈ Construction Site Safety Analyzer
Overview
The Construction Site Safety Analyzer is a powerful tool designed to enhance workplace safety and compliance through AI-powered image and video analysis. Leveraging the capabilities of Llama 3.2 90B Vision and expert chat assistance, this application helps identify safety issues, categorize them, provide detailed descriptions, and suggest steps to resolve them.
Features
1. Image Analysis
- Upload Multiple Images: Easily upload multiple construction site images for comprehensive analysis.
- Automatic Image Resizing: Ensures that images do not exceed API size limits while maintaining quality.
- Safety Hazard Identification: Identifies potential safety hazards, categorizes them, and provides detailed descriptions.
- Resolution Suggestions: Offers actionable steps to mitigate identified risks.
2. Video Analysis
- Upload Videos: Upload videos to analyze specific frames for safety hazard identification.
- Key Frame Extraction: Extracts key frames from videos at specified time points (default: start, middle, end).
- Detailed Analysis: Provides detailed analysis for each extracted frame, similar to image analysis.
3. Expert Chat Assistance
- Interactive Chat: Engage in real-time conversations with an AI assistant specializing in construction site safety.
- Question-Based Analysis: Ask questions about specific safety measures or regulations related to the analyzed hazards.
- Comprehensive Insights: Receive detailed answers based on the initial analysis, enhancing understanding and decision-making.
Getting Started
Prerequisites
- Python 3.8+
pip
(Python package installer)
Installation
Clone the repository:
git clone https://github.com/your-repo/construction-site-safety-analyzer.git cd construction-site-safety-analyzer
Install dependencies:
pip install -r requirements.txt
Set up environment variables:
export GROQ_API_KEY="your-groq-api-key"
Running the Application
To launch the application, simply run the main script:
python app.py
This will start a local server, and you can access the application via your web browser at http://localhost:7860
.
Usage
- Upload Images/Videos: Navigate to the "Upload Construction Site Images" or "Upload Construction Site Video" sections and select the appropriate files.
- Analyze Safety Hazards: Click the "π Analyze Safety Hazards" button to initiate the analysis process.
- View Analysis Results: The safety analysis results will be displayed in the "Safety Analysis Results and Expert Chat" section.
- Chat with the Assistant: Engage in interactive conversations with the AI assistant to get more insights or ask questions about specific safety measures.
Requirements
The application requires the following Python packages:
os
base64
gradio
PIL
io
json
groq
logging
cv2
numpy
traceback
These dependencies can be installed using pip
as shown in the installation instructions.
Contributing
Contributions are welcome! Feel free to submit pull requests, report bugs, or suggest improvements.
License
This project is licensed under the MIT License - see the MIT file for details.
Built with β€οΈ by CA Pradeep Gujaran