File size: 3,415 Bytes
b70b1c9 b1c79c4 b70b1c9 e95d9e4 b70b1c9 b1c79c4 b70b1c9 e95d9e4 b70b1c9 b1c79c4 b70b1c9 e95d9e4 b70b1c9 b1c79c4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b1c79c4 b70b1c9 b1c79c4 b70b1c9 b1c79c4 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 e95d9e4 b70b1c9 b1c79c4 b70b1c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# 🏗️ 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
1. Clone the repository:
```bash
git clone https://github.com/your-repo/construction-site-safety-analyzer.git
cd construction-site-safety-analyzer
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up environment variables:
```bash
export GROQ_API_KEY="your-groq-api-key"
```
### Running the Application
To launch the application, simply run the main script:
```bash
python app.py
```
This will start a local server, and you can access the application via your web browser at `http://localhost:7860`.
## Usage
1. **Upload Images/Videos**: Navigate to the "Upload Construction Site Images" or "Upload Construction Site Video" sections and select the appropriate files.
2. **Analyze Safety Hazards**: Click the "🔍 Analyze Safety Hazards" button to initiate the analysis process.
3. **View Analysis Results**: The safety analysis results will be displayed in the "Safety Analysis Results and Expert Chat" section.
4. **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 [LICENSE](LICENSE) file for details.
---
Built with ❤️ by [Your Name] |