File size: 687 Bytes
19e1bb9 7bfe687 19e1bb9 7bfe687 19e1bb9 7bfe687 19e1bb9 7bfe687 19e1bb9 7bfe687 19e1bb9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # app.py
import gradio as gr
from ultralytics import YOLO
from PIL import Image
# Load the YOLOv8 model
model = YOLO("yolo_weights/yolov8n.pt") # path to your weights
def detect_objects(img):
results = model(img)
result_img = results[0].plot() # render boxes on the image
return Image.fromarray(result_img)
# Gradio UI
demo = gr.Interface(
fn=detect_objects,
inputs=gr.Image(type="pil", label="Upload Lunar Image"),
outputs=gr.Image(type="pil", label="Detection Output"),
title="Lunar Landslide & Boulder Detector",
description="This interface uses a YOLOv8 model to detect lunar geological features."
)
if __name__ == "__main__":
demo.launch()
|