Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,18 +11,18 @@ from ultralyticsplus import YOLO
|
|
11 |
|
12 |
app_title = "Detect defects in bird nest jar"
|
13 |
models_ids = ['linhcuem/defects_bird_nest_jar_yolov5m6']
|
14 |
-
DEFAULT_DET_MODEL_ID_yolov5 = 'linhcuem/defects_bird_nest_jar_yolov5m6'
|
15 |
-
DEFAULT_DET_MODEL_ID_yolov8 = 'linhcuem/defects_bird_nest_jar_yolov8'
|
16 |
|
17 |
current_model_id = models_ids[-1]
|
18 |
model = yolov5.load(current_model_id)
|
19 |
-
model_yolov8 = YOLO(DEFAULT_DET_MODEL_ID_yolov8)
|
20 |
examples = [['test_images/16823291638707408-a2A2448-23gmBAS_40174045.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5'], ['test_images/16823292102253310-a2A2448-23gmBAS_40174046.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5'], ['test_images/16823291808953550-a2A2448-23gmBAS_40174048.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5'], ['test_images/16823291801532480-a2A2448-23gmBAS_40174048.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5']]
|
21 |
|
22 |
def predict(image, threshold=0.25, model_id=None):
|
23 |
#update model if required
|
24 |
global current_model_id
|
25 |
-
global
|
26 |
if model_id != current_model_id:
|
27 |
model = yolov5.load(models_id)
|
28 |
# model_yolov8 = YOLO(DEFAULT_DET_MODEL_ID_yolov8)
|
|
|
11 |
|
12 |
app_title = "Detect defects in bird nest jar"
|
13 |
models_ids = ['linhcuem/defects_bird_nest_jar_yolov5m6']
|
14 |
+
# DEFAULT_DET_MODEL_ID_yolov5 = 'linhcuem/defects_bird_nest_jar_yolov5m6'
|
15 |
+
# DEFAULT_DET_MODEL_ID_yolov8 = 'linhcuem/defects_bird_nest_jar_yolov8'
|
16 |
|
17 |
current_model_id = models_ids[-1]
|
18 |
model = yolov5.load(current_model_id)
|
19 |
+
# model_yolov8 = YOLO(DEFAULT_DET_MODEL_ID_yolov8)
|
20 |
examples = [['test_images/16823291638707408-a2A2448-23gmBAS_40174045.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5'], ['test_images/16823292102253310-a2A2448-23gmBAS_40174046.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5'], ['test_images/16823291808953550-a2A2448-23gmBAS_40174048.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5'], ['test_images/16823291801532480-a2A2448-23gmBAS_40174048.jpg', 0.25, 'linhcuem/defects_nest_jar_yolov5']]
|
21 |
|
22 |
def predict(image, threshold=0.25, model_id=None):
|
23 |
#update model if required
|
24 |
global current_model_id
|
25 |
+
global model
|
26 |
if model_id != current_model_id:
|
27 |
model = yolov5.load(models_id)
|
28 |
# model_yolov8 = YOLO(DEFAULT_DET_MODEL_ID_yolov8)
|