Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,9 +25,9 @@ model = torch.load("best_model-epoch=01-val_loss=3.00.ckpt")
|
|
25 |
def preprocess_input(input):
|
26 |
"""Preprocess the input image for the PyTorch image classification model.
|
27 |
Args:
|
28 |
-
|
29 |
Returns:
|
30 |
-
|
31 |
"""
|
32 |
|
33 |
# Resize the image to the expected size.
|
@@ -46,9 +46,9 @@ def preprocess_input(input):
|
|
46 |
async def predict_endpoint(input: Any):
|
47 |
"""Predict the output of the PyTorch image classification model.
|
48 |
Args:
|
49 |
-
|
50 |
Returns:
|
51 |
-
|
52 |
"""
|
53 |
|
54 |
# Load the image.
|
@@ -69,4 +69,4 @@ async def predict_endpoint(input: Any):
|
|
69 |
|
70 |
if _name_ == "_main_":
|
71 |
import uvicorn
|
72 |
-
uvicorn.run(app, host="0.0.0.0",
|
|
|
25 |
def preprocess_input(input):
|
26 |
"""Preprocess the input image for the PyTorch image classification model.
|
27 |
Args:
|
28 |
+
input: A PIL Image object.
|
29 |
Returns:
|
30 |
+
A PyTorch tensor representing the preprocessed image.
|
31 |
"""
|
32 |
|
33 |
# Resize the image to the expected size.
|
|
|
46 |
async def predict_endpoint(input: Any):
|
47 |
"""Predict the output of the PyTorch image classification model.
|
48 |
Args:
|
49 |
+
input: A file containing the input image.
|
50 |
Returns:
|
51 |
+
A JSON object containing the prediction.
|
52 |
"""
|
53 |
|
54 |
# Load the image.
|
|
|
69 |
|
70 |
if _name_ == "_main_":
|
71 |
import uvicorn
|
72 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|