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 |
|
@@ -14,8 +14,8 @@ with fs.open(model_path, 'rb') as f:
|
|
14 |
with open('best_model.pth', 'wb') as f:
|
15 |
f.write(model_content)
|
16 |
|
17 |
-
# Load your custom model
|
18 |
-
model = torch.load('best_model.pth')
|
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 |
|
|
|
14 |
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('best_model.pth', map_location=torch.device('cpu'))
|
19 |
model.eval()
|
20 |
|
21 |
# Define a function that takes an image as input and uses the model for inference
|