edcelbogs's picture
Update README.md
35bd147 verified

A newer version of the Gradio SDK is available: 6.16.0

Upgrade
metadata
title: Fire Detections YOLOv8
emoji: πŸ‘
colorFrom: green
colorTo: indigo
sdk: gradio
sdk_version: 6.12.0
app_file: app.py
pinned: false

πŸ”₯ Live Fire & Smoke Detection using YOLOv8

πŸ“Œ Project Overview

This project is a real-time fire and smoke detection system powered by a YOLOv8 deep learning model. It utilizes a webcam feed to perform frame-by-frame object detection and visually highlights detected fire or smoke regions.

The system is deployed using Gradio, allowing users to access the application through a web interface, including support for live webcam streaming in the browser.


🎯 Objectives

  • Detect fire and smoke in real time using a trained YOLOv8 model
  • Provide a simple and interactive web-based interface
  • Enable deployment on cloud platforms such as Hugging Face Spaces
  • Demonstrate AI-based hazard detection without hardware dependencies

βš™οΈ Technologies Used

  • Python
  • Ultralytics YOLOv8
  • OpenCV
  • Gradio
  • NumPy

πŸ“ Project Structure

fire-smoke-detection/
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€-nano_best.pt
└── README.md

πŸš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/your-username/fire-smoke-detection.git
cd fire-smoke-detection

2. Install Dependencies

pip install -r requirements.txt

3. Run the Application

python app.py

πŸ“¦ Requirements

ultralytics
opencv-python-headless
gradio
numpy
torch

🧠 How It Works

  1. The webcam captures live frames through the browser
  2. Each frame is processed using the YOLOv8 model
  3. The model detects fire or smoke based on trained features
  4. Detected objects are highlighted with bounding boxes
  5. The annotated frame is displayed in real time

πŸŽ₯ Features

  • πŸ”΄ Real-time webcam detection
  • πŸ” YOLOv8-based object detection
  • πŸ–₯️ Web interface using Gradio
  • ☁️ Cloud deployment ready (Hugging Face Spaces)
  • ⚑ Lightweight model for faster inference

⚠️ Limitations

  • Frame rate depends on internet speed and server performance
  • Not suitable for high-FPS real-time systems
  • Requires a trained YOLOv8 model (.pt file)
  • Webcam access depends on browser permissions

πŸ“Œ Deployment (Hugging Face Spaces)

  1. Create a new Space (Gradio SDK)

  2. Upload:

    • app.py
    • requirements.txt
    • model file or model URL
  3. Wait for automatic build and deployment


πŸ“· Usage

  • Open the deployed app in a browser
  • Allow webcam access
  • Start live detection
  • Observe bounding boxes for fire/smoke detection

πŸ”₯ Future Improvements

  • Add confidence score display
  • Support video upload detection
  • Integrate Firebase for real-time logging
  • Optimize model for faster inference (YOLOv8 Nano/Tiny)
  • Add alert system (sound/email notification)

πŸ‘¨β€πŸ’» Author

Developed as part of an academic project on AI-based fire detection and IoT systems.


πŸ“„ License

This project is for educational and research purposes.

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference