DrChamyoung commited on
Commit
86c0982
·
verified ·
1 Parent(s): e3b4d65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -18
app.py CHANGED
@@ -2,25 +2,16 @@ import torch
2
  import matplotlib.pyplot as plt
3
  import pandas as pd
4
  import seaborn as sns
5
- from ultralytics import YOLO
6
- import os
7
 
8
- # Correct path to your model file
9
- MODEL_PATH = "models/evoSEGA.pt" # exact case match to repo
10
 
11
- if not os.path.exists(MODEL_PATH):
12
- raise FileNotFoundError(f"Model file not found at {MODEL_PATH}")
13
 
14
- # Load YOLO model
15
- model = YOLO(MODEL_PATH)
16
 
17
- # Example prediction
18
- TEST_IMAGE = "test.jpg"
19
- if not os.path.exists(TEST_IMAGE):
20
- raise FileNotFoundError(f"Test image not found at {TEST_IMAGE}")
21
-
22
- results = model(TEST_IMAGE)
23
-
24
- for r in results:
25
- print(r.boxes)
26
- r.show()
 
2
  import matplotlib.pyplot as plt
3
  import pandas as pd
4
  import seaborn as sns
 
 
5
 
6
+ # Path to model
7
+ MODEL_PATH = "Model/EvoSEGA/evoSEGA.pt"
8
 
9
+ # Load YOLOv5 model
10
+ model = torch.hub.load("ultralytics/yolov5", "custom", path=MODEL_PATH, force_reload=True)
11
 
12
+ # Run inference
13
+ results = model("test.jpg")
14
 
15
+ # Print results
16
+ print(results.pandas().xyxy[0]) # Pandas dataframe
17
+ results.show() # Show image with detections