Skip to content

Commit

Permalink
Update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKoornstra committed Mar 25, 2024
1 parent dfd5cc8 commit 36460ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion api/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,14 @@ def setup_model(self, model_name: str, args: DummyArgs):

def safe_predict(data, device):
"""
Attempt to predict on the specified device, falling back to CPU on OOM.
Attempt to predict on the speci
Args:
data: Data to predict on
device: Device to predict on
Returns:
Prediction output
"""

try:
Expand Down
4 changes: 3 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def cpu_call(self, data: AugInput, device: str = None) -> tuple[dict, int, int]:
Args:
data (AugInput): image to run the model on
device (str): device to run the model on
Returns:
tuple[dict, int, int]: predictions, height, width
Expand Down Expand Up @@ -182,12 +183,13 @@ def cpu_call(self, data: AugInput, device: str = None) -> tuple[dict, int, int]:

return predictions, height, width

def __call__(self, data: AugInput, device: str = None):
def __call__(self, data: AugInput, device: str = None) -> tuple[dict, int, int]:
"""
Run the model on the image with preprocessing
Args:
data (AugInput): image to run the model on
device (str): device to run the model on
Returns:
tuple[dict, int, int]: predictions, height, width
"""
Expand Down

0 comments on commit 36460ca

Please sign in to comment.