Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,13 +10,10 @@ class Prediction:
|
|
10 |
prediction: TorchTensor
|
11 |
|
12 |
app = fastapi.FastAPI(docs_url="/")
|
13 |
-
pre_trained_model = torch.load('best_model.pth',map_location=torch.device('cpu'))
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
|
18 |
-
# Load the state dictionary into the current model
|
19 |
-
model = pre_trained_model
|
20 |
# Define a function to preprocess the input image
|
21 |
def preprocess_input(input: fastapi.UploadFile):
|
22 |
image = Image.open(input.file)
|
|
|
10 |
prediction: TorchTensor
|
11 |
|
12 |
app = fastapi.FastAPI(docs_url="/")
|
|
|
13 |
|
14 |
+
# Load the pre-trained model
|
15 |
+
pre_trained_model = torch.load('best_model.pth', map_location=torch.device('cpu'))
|
16 |
|
|
|
|
|
17 |
# Define a function to preprocess the input image
|
18 |
def preprocess_input(input: fastapi.UploadFile):
|
19 |
image = Image.open(input.file)
|