DrChamyoung commited on
Commit
2aea7d6
·
verified ·
1 Parent(s): 839b706

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -13
app.py CHANGED
@@ -1,17 +1,20 @@
1
  import torch
2
- import os
 
 
 
3
 
4
- # Download the model from Hugging Face
5
- model_path = "evoSEGA.pt"
6
- if not os.path.exists(model_path):
7
- torch.hub.download_url_to_file(
8
- "https://huggingface.co/DrChamyoung/EvoSEGA/resolve/main/evoSEGA.pt",
9
- model_path
10
- )
11
 
12
- # Load YOLOv5 model from .pt file
13
- model = torch.hub.load('ultralytics/yolov5', 'custom', path=model_path, source='github')
14
 
15
- # Test with an image
16
- results = model("https://ultralytics.com/images/zidane.jpg")
17
- results.show() # Show detection results
 
 
 
 
 
 
1
  import torch
2
+ import matplotlib.pyplot as plt
3
+ import pandas as pd
4
+ import seaborn as sns
5
+ from ultralytics import YOLO
6
 
7
+ # Path to your model file
8
+ MODEL_PATH = "EvoSEGA/evoSEGA.pt" # relative path inside repo
 
 
 
 
 
9
 
10
+ # Load YOLO model
11
+ model = YOLO(MODEL_PATH)
12
 
13
+ # Example prediction (replace 'test.jpg' with your image)
14
+ results = model("test.jpg")
15
+
16
+ # Print results
17
+ for r in results:
18
+ print(r.boxes)
19
+ # Optionally plot
20
+ r.show()