Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,20 @@ import tensorflow as tf
|
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
| 4 |
from glob import glob
|
| 5 |
-
from models import Yolov4
|
| 6 |
import gradio as gr
|
| 7 |
-
model = Yolov4(weight_path="best.pt", class_name_path='coco_classes.txt')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def gradio_wrapper(img):
|
| 9 |
global model
|
| 10 |
#print(np.shape(img))
|
|
|
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
| 4 |
from glob import glob
|
| 5 |
+
# from models import Yolov4
|
| 6 |
import gradio as gr
|
| 7 |
+
# model = Yolov4(weight_path="best.pt", class_name_path='coco_classes.txt')
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from ultralytics import YOLO
|
| 11 |
+
|
| 12 |
+
# Load a model
|
| 13 |
+
model = YOLO("best.pt") # load a custom model
|
| 14 |
+
|
| 15 |
+
# Predict with the model
|
| 16 |
+
# results = model("image.jpg", save = True) # predict on an image
|
| 17 |
+
|
| 18 |
+
|
| 19 |
def gradio_wrapper(img):
|
| 20 |
global model
|
| 21 |
#print(np.shape(img))
|