import gradio as gr
from ultralytics import YOLO

# Modeli yükle
model = YOLO("yolov8n.pt")  # Küçük ve hızlı YOLOv8 modeli

# Video işleme fonksiyonu
def process_video(video):
    results = model(video)  # Videoyu modelle işleyin
    output_path = "output.mp4"
    results.save(output_path)  # İşlenmiş videoyu kaydedin
    return output_path

# Gradio arayüzü
iface = gr.Interface(
    fn=process_video,
    inputs=gr.Video(type="mp4"),
    outputs=gr.Video(),
    title="Nesne Tanıma Aracı",
    description="Videodaki nesneleri tanıyan bir yapay zeka aracı."
)

iface.launch()