DSatishchandra commited on
Commit
2c10aba
·
verified ·
1 Parent(s): e629b5d

Update models/windmill_model.py

Browse files
Files changed (1) hide show
  1. models/windmill_model.py +7 -3
models/windmill_model.py CHANGED
@@ -1,5 +1,9 @@
1
- from transformers import AutoModelForObjectDetection
2
 
3
  def load_windmill_model():
4
- model = AutoModelForObjectDetection.from_pretrained("ultralytics/yolov5s") # You may want to customize this model
5
- return model
 
 
 
 
 
1
+ import torch
2
 
3
  def load_windmill_model():
4
+ try:
5
+ model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True, force_reload=False)
6
+ model.eval()
7
+ return model
8
+ except Exception as e:
9
+ raise Exception(f"Error loading windmill model: {str(e)}")