Spaces:
Runtime error
Runtime error
Download app.py from nomypython/carddh: direct link, hf CLI and curl.
- Browser
- Download file 448 Bytes
-
https://huggingface.co/spaces/nomypython/carddh/resolve/main/app.py
- Command line
-
hf download hf://spaces/nomypython/carddh/app.py
-
curl -L -o app.py https://huggingface.co/spaces/nomypython/carddh/resolve/main/app.py
448 Bytes
| 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() |