Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,9 +3,20 @@ from ultralytics import YOLO
|
|
3 |
import cv2
|
4 |
import os
|
5 |
import uuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
# Load YOLOv8 model (make sure the file is uploaded)
|
8 |
-
model = YOLO("best.pt") # Replace with your actual model name if different
|
9 |
|
10 |
def detect_faults(video):
|
11 |
temp_dir = "temp_" + str(uuid.uuid4())
|
|
|
3 |
import cv2
|
4 |
import os
|
5 |
import uuid
|
6 |
+
import os
|
7 |
+
import torch
|
8 |
+
from ultralytics import YOLO
|
9 |
+
|
10 |
+
# Automatically download your best.pt model from your dataset repo
|
11 |
+
model_path = "best.pt"
|
12 |
+
if not os.path.exists(model_path):
|
13 |
+
os.system("wget https://huggingface.co/datasets/Prasanna1622/solar-fault-dataset/resolve/main/best.pt")
|
14 |
+
|
15 |
+
# Load the model
|
16 |
+
model = YOLO(model_path)
|
17 |
+
|
18 |
+
# Your Gradio/Streamlit app here...
|
19 |
|
|
|
|
|
20 |
|
21 |
def detect_faults(video):
|
22 |
temp_dir = "temp_" + str(uuid.uuid4())
|