Skip to content

Repository files navigation

๐Ÿ›ก๏ธ osha_ai_app

ML-based system to predict workplace incident outcomes using OSHA data, combining TF-IDF and LightGBM with a deployable Streamlit interface.

๐Ÿ›ก๏ธ SafeGuard AI

AI-Powered Workplace Safety Risk Prediction & OSHA Safety Assistant

SafeGuard AI is an end-to-end AI platform that predicts workplace incident outcomes using OSHA data, provides AI-powered safety explanations, generates downloadable reports, and assists users with OSHA-related queries through an intelligent chatbot.


๐Ÿ“Œ Problem Statement

Workplace accidents remain a major challenge across industries due to delayed risk assessment, inconsistent reporting, and limited access to actionable safety insights. Traditional methods often rely on manual investigation after an incident has already occurred.

SafeGuard AI addresses these challenges by combining Machine Learning and Generative AI to predict workplace incident outcomes, explain risks, recommend preventive measures, and support OSHA compliance.


๐ŸŽฏ Objectives

  • Predict workplace incident outcomes using OSHA data.
  • Provide AI-powered explanations for predicted risks.
  • Generate detailed safety reports.
  • Offer an OSHA Safety Assistant chatbot.
  • Support multilingual safety assistance.
  • Help organizations improve workplace safety.

๐Ÿง  System Overview

The platform combines:

  • LightGBM Machine Learning Model
  • TF-IDF Text Processing
  • Google Gemini AI
  • Streamlit Web Application

Users enter workplace, job, and incident details. The system predicts the likely incident outcome, generates AI explanations, recommends preventive actions, and allows downloading reports.


๐Ÿ” High-Level Workflow

Login โ†’ Enter Company Information โ†’ Enter Job Details โ†’ Enter Incident Details โ†’ Data Preprocessing โ†’ TF-IDF Encoding โ†’ LightGBM Prediction โ†’ AI Explanation (Gemini) โ†’ Download Report โ†’ OSHA Safety Assistant


๐Ÿ—๏ธ System Architecture

User Input
    โ”‚
    โ–ผ
Data Cleaning & Feature Engineering
    โ”‚
    โ–ผ
TF-IDF + Feature Encoding
    โ”‚
    โ–ผ
LightGBM Model
    โ”‚
    โ–ผ
Prediction
    โ”‚
    โ–ผ
Google Gemini AI
    โ”‚
    โ–ผ
Safety Explanation & Report
    โ”‚
    โ–ผ
Streamlit Dashboard

โš™๏ธ Tech Stack

Layer Technology
Programming Language Python
Machine Learning LightGBM
NLP TF-IDF
Generative AI Google Gemini
Frontend Streamlit
Data Processing Pandas, NumPy
Model Storage Pickle
Version Control Git & GitHub

โœจ Key Features

  • Workplace Risk Prediction
  • OSHA Incident Outcome Prediction
  • AI Safety Explanation
  • Root Cause Analysis
  • Risk Factors Identification
  • Prevention Recommendations
  • Worker Treatment Suggestions
  • Long-term Safety Measures
  • AI Safety Assistant Chatbot
  • Multilingual Support
  • PDF & Report Download
  • Secure Login System

๐Ÿ“Š Prediction Output

The application provides:

  • Predicted Incident Outcome
  • Confidence Score
  • AI Safety Explanation
  • Root Cause
  • Risk Factors
  • Recurrence Analysis
  • Prevention & Solutions
  • Worker Treatment
  • Long-term Safety Measures
  • Downloadable Report

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.10+
  • pip

Installation

git clone https://github.com/Lokeswari3173/osha_ai_app.git
cd osha_ai_app
pip install -r requirements.txt

Run

streamlit run app.py

Open:

http://localhost:8501


๐Ÿ“ Project Structure

osha_ai_app/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ train.py
โ”œโ”€โ”€ preprocessing.py
โ”œโ”€โ”€ data_cleaning.py
โ”œโ”€โ”€ feature_engineering.py
โ”œโ”€โ”€ encoding.py
โ”œโ”€โ”€ geo_features.py
โ”œโ”€โ”€ text_processing.py
โ”œโ”€โ”€ genai_helper.py
โ”œโ”€โ”€ final_model.pkl
โ”œโ”€โ”€ users.json
โ”œโ”€โ”€ models/
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ screenshots/

๐Ÿ“ˆ Results & Impact

  • Predicts workplace incident outcomes using OSHA data.
  • Generates AI-powered workplace safety insights.
  • Improves workplace risk awareness.
  • Supports proactive accident prevention.
  • Assists organizations with OSHA compliance.
  • Reduces manual safety assessment effort.

๐Ÿ”ฎ Future Scope

  • Real-time IoT integration
  • CCTV-based safety monitoring
  • Voice-enabled AI assistant
  • Mobile application
  • Cloud deployment
  • Dashboard analytics
  • Enterprise integration
  • Advanced multilingual support

๐Ÿญ Use Cases

  • Construction
  • Manufacturing
  • Healthcare
  • Logistics
  • Energy
  • Government Organizations

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Mangasamudram Lokeswari

Data Science | Machine Learning | Generative AI

GitHub: https://github.com/Lokeswari3173


โญ Support

If you found this project useful:

  • โญ Star this repository
  • ๐Ÿด Fork it
  • ๐Ÿ“ข Share it

๐Ÿ“œ License

This project is licensed under the MIT License.


๐Ÿ“ธ Application Screenshots

๐Ÿ” Login Page

Secure authentication page for users to log in or create a new account before accessing the platform.

image

๐Ÿ  Home Dashboard

The main dashboard provides an overview of SafeGuard AI, live risk insights, supported industries, and quick navigation to prediction and AI assistance.

image image

๐Ÿข Company Information

Users can enter company details such as company name, industry, organization size, number of employees, and total working hours.

image

๐Ÿ‘จโ€๐Ÿ’ผ Job Information & Incident Details

Input job description, SOC details, incident description, injury information, location, and object/substance involved in the incident.

image

โš™๏ธ Risk Prediction Form

Complete workplace incident details, timing, work impact, establishment information, and additional safety parameters required for prediction.

image

๐ŸŽฏ Prediction Result

Displays the predicted workplace incident outcome along with the model confidence score.(image


๐Ÿค– AI Safety Explanation

Generates an AI-powered explanation including root cause analysis, risk factors, recurrence probability, and detailed workplace safety insights. image

image

๐Ÿ“„ AI Safety Report

Provides a comprehensive safety report containing prevention strategies, worker treatment recommendations, and long-term safety measures.


๐Ÿ“ฅ Report Download

Users can download the generated AI Safety Report and Prediction Report in PDF format for documentation and future reference.

๐Ÿ’ฌ AI Safety Assistant

Interactive AI chatbot that answers OSHA regulations, workplace safety practices, hazard prevention, and incident response queries.

image

About

ML-based system to predict workplace incident outcomes using OSHA data, combining TF-IDF and LightGBM with a deployable Streamlit interface.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages