Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from PIL import Image
|
|
6 |
|
7 |
# Authenticate and download the custom model from Hugging Face Spaces
|
8 |
fs = HfFileSystem()
|
9 |
-
model_path = 'dhhd255/
|
10 |
with fs.open(model_path, 'rb') as f:
|
11 |
model_content = f.read()
|
12 |
|
@@ -15,7 +15,7 @@ with open('best_model.pth', 'wb') as f:
|
|
15 |
f.write(model_content)
|
16 |
|
17 |
# Load your custom model onto the CPU
|
18 |
-
model = torch.load('
|
19 |
model.eval()
|
20 |
|
21 |
# Define a function that takes an image as input and uses the model for inference
|
|
|
6 |
|
7 |
# Authenticate and download the custom model from Hugging Face Spaces
|
8 |
fs = HfFileSystem()
|
9 |
+
model_path = 'dhhd255/main_model/best_model.pth'
|
10 |
with fs.open(model_path, 'rb') as f:
|
11 |
model_content = f.read()
|
12 |
|
|
|
15 |
f.write(model_content)
|
16 |
|
17 |
# Load your custom model onto the CPU
|
18 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best_model.pth')
|
19 |
model.eval()
|
20 |
|
21 |
# Define a function that takes an image as input and uses the model for inference
|