Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from ultralytics import YOLO | |
| import os | |
| # Download the model from Google Drive if it's not present | |
| model_path = "best.pt" | |
| # Load the YOLOv8 model | |
| model = YOLO(model_path) | |
| # Define the object detection function | |
| def detect_objects(image): | |
| results = model(image) | |
| return results[0].plot() | |
| # Create a Gradio interface | |
| app = gr.Interface(fn=detect_objects, inputs="image", outputs="image") | |
| # Launch Gradio app | |
| app.launch() |