Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import gradio as gr
|
| 3 |
from PIL import Image
|
| 4 |
-
import os
|
| 5 |
import zipfile
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Load the YOLOv8 model (ensure the path is correct)
|
| 9 |
model = YOLO('best-3.pt') # Path to your trained YOLOv8 model
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
import os
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
| 6 |
from PIL import Image
|
|
|
|
| 7 |
import zipfile
|
| 8 |
+
|
| 9 |
+
# Install ultralytics if not already installed
|
| 10 |
+
try:
|
| 11 |
+
from ultralytics import YOLO
|
| 12 |
+
except ImportError:
|
| 13 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "ultralytics"])
|
| 14 |
+
from ultralytics import YOLO
|
| 15 |
|
| 16 |
# Load the YOLOv8 model (ensure the path is correct)
|
| 17 |
model = YOLO('best-3.pt') # Path to your trained YOLOv8 model
|