FireDetection / main.py
bahakizil's picture
Upload 4 files
1afa0e4 verified
raw
history blame
1.12 kB
import gradio as gr
import os
from firedetection import detect_fire_in_video
TEMP_DIR = "temp_outputs"
os.makedirs(TEMP_DIR, exist_ok=True)
MODEL_PATH = "/Users/bahakizil/Desktop/firedetection/last.pt" # Fire detection model .pt dosyası (örnek)
DEVICE = "cpu" # İsterseniz 'cpu' veya 'cuda' vb. olarak değiştirebilirsiniz.
def fire_detection_interface(video_file):
if not video_file:
return None
input_video_path = video_file
base_name = os.path.basename(input_video_path)
name_no_ext, ext = os.path.splitext(base_name)
output_video_path = os.path.join(TEMP_DIR, f"{name_no_ext}_fire_detection{ext}")
processed_path = detect_fire_in_video(
input_video_path=input_video_path,
output_video_path=output_video_path,
model_path=MODEL_PATH,
device=DEVICE
)
return processed_path
demo = gr.Interface(
fn=fire_detection_interface,
inputs=gr.Video(label="Video Yükleyin"),
outputs=gr.Video(label="İşlenmiş Video"),
title="Fire Detection",
description=(
),
)
if __name__ == "__main__":
demo.launch()