Skip to content

Commit

Permalink
Fix demo to use new predict location. Also tweak imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsilter committed May 28, 2024
1 parent 3526498 commit 30b9ff3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion scripts/run_inference_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ if [ ! -d "$demo_scan_dir" ]; then
unzip -q sybil_example.zip
fi

python3 scripts/inference.py \
# Either python3 sybil/predict.py or sybil-predict (if installed via pip)
python3 sybil/predict.py \
--loglevel DEBUG \
--output-dir demo_prediction \
--return-attentions \
Expand Down
2 changes: 1 addition & 1 deletion sybil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
from sybil.utils.visualization import visualize_attentions
import sybil.utils.logging_utils

__all__ = ["Sybil", "Serie", "visualize_attentions"]
__all__ = ["Sybil", "Serie", "visualize_attentions", "__version__"]
7 changes: 4 additions & 3 deletions sybil/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

import sybil.utils.logging_utils
import sybil.datasets.utils
from sybil import Serie, Sybil, visualize_attentions
from sybil import Serie, Sybil, visualize_attentions, __version__


def _get_parser():
description = __doc__ + f"\nVersion: {sybil.__version__}\n"
description = __doc__ + f"\nVersion: {__version__}\n"
parser = argparse.ArgumentParser(description=description)

parser.add_argument(
Expand Down Expand Up @@ -69,7 +69,7 @@ def _get_parser():
parser.add_argument("-l", "--log", "--loglevel", "--log-level",
default="INFO", dest="loglevel")

parser.add_argument("-v", "--version", action="version", version=sybil.__version__)
parser.add_argument("-v", "--version", action="version", version=__version__)

return parser

Expand Down Expand Up @@ -101,6 +101,7 @@ def predict(
if extension.lower() in {".png", "png"}:
file_type = "png"
voxel_spacing = sybil.datasets.utils.VOXEL_SPACING
logger.debug(f"Using default voxel spacing: {voxel_spacing}")
assert file_type in {"dicom", "png"}
file_type = typing.cast(Literal["dicom", "png"], file_type)

Expand Down

0 comments on commit 30b9ff3

Please sign in to comment.