Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from PIL import Image | |
| from ultralytics import YOLO | |
| # Load your trained model | |
| model = YOLO("yolo26n.pt") | |
| def detect_poles(image): | |
| results = model.predict(image, conf=0.25) | |
| annotated = results[0].plot() # returns annotated numpy image | |
| return Image.fromarray(annotated) | |
| demo = gr.Interface( | |
| fn=detect_poles, | |
| inputs=gr.Image(type="pil", label="Upload Pole Image"), | |
| outputs=gr.Image(type="pil", label="Detected Poles"), | |
| title="Pole Detection", | |
| description="Upload an image to detect poles." | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |