Skip to content

Commit

Permalink
feat: Updated src/api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-nightly[bot] authored Oct 24, 2023
1 parent 8c2e731 commit a0dd54e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
app = FastAPI()

@app.post("/predict/")
"""
This function takes an uploaded image file, preprocesses it, and makes a prediction using the loaded PyTorch model.
async def predict(file: UploadFile = File(...)):
"""
This function takes an uploaded image file, preprocesses it, and makes a prediction using the loaded PyTorch model.
Parameters:
file: The uploaded image file.
Parameters:
file: The uploaded image file.
Returns:
A dictionary with the key 'prediction' and the predicted digit as the value.
"""
async def predict(file: UploadFile = File(...)):
Returns:
A dictionary with the key 'prediction' and the predicted digit as the value.
"""
# Open the image file and convert it to grayscale
image = Image.open(file.file).convert("L")
# Apply the defined transformations to the image
Expand Down

0 comments on commit a0dd54e

Please sign in to comment.