ML-based system to predict workplace incident outcomes using OSHA data, combining TF-IDF and LightGBM with a deployable Streamlit interface.
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.
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.
- 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.
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.
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
User Input
โ
โผ
Data Cleaning & Feature Engineering
โ
โผ
TF-IDF + Feature Encoding
โ
โผ
LightGBM Model
โ
โผ
Prediction
โ
โผ
Google Gemini AI
โ
โผ
Safety Explanation & Report
โ
โผ
Streamlit Dashboard
| 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 |
- 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
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
- Python 3.10+
- pip
git clone https://github.com/Lokeswari3173/osha_ai_app.git
cd osha_ai_app
pip install -r requirements.txtstreamlit run app.pyOpen:
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/
- 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.
- Real-time IoT integration
- CCTV-based safety monitoring
- Voice-enabled AI assistant
- Mobile application
- Cloud deployment
- Dashboard analytics
- Enterprise integration
- Advanced multilingual support
- Construction
- Manufacturing
- Healthcare
- Logistics
- Energy
- Government Organizations
Mangasamudram Lokeswari
Data Science | Machine Learning | Generative AI
GitHub: https://github.com/Lokeswari3173
If you found this project useful:
- โญ Star this repository
- ๐ด Fork it
- ๐ข Share it
This project is licensed under the MIT License.
Secure authentication page for users to log in or create a new account before accessing the platform.
The main dashboard provides an overview of SafeGuard AI, live risk insights, supported industries, and quick navigation to prediction and AI assistance.
Users can enter company details such as company name, industry, organization size, number of employees, and total working hours.
Input job description, SOC details, incident description, injury information, location, and object/substance involved in the incident.
Complete workplace incident details, timing, work impact, establishment information, and additional safety parameters required for prediction.
Displays the predicted workplace incident outcome along with the model confidence score.(
Generates an AI-powered explanation including root cause analysis, risk factors, recurrence probability, and detailed workplace safety insights.

Provides a comprehensive safety report containing prevention strategies, worker treatment recommendations, and long-term safety measures.
Users can download the generated AI Safety Report and Prediction Report in PDF format for documentation and future reference.
Interactive AI chatbot that answers OSHA regulations, workplace safety practices, hazard prevention, and incident response queries.