Skip to content

Commit

Permalink
Merge pull request #39 from BrainLesion/31-feature-request-citation-r…
Browse files Browse the repository at this point in the history
…eminder

31 feature request citation reminder
  • Loading branch information
neuronflow authored Mar 4, 2024
2 parents 4a6613f + 9119ed7 commit 0fb38b0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions brainles_aurora/inferer/inferer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from brainles_aurora.inferer.data import DataHandler
from brainles_aurora.inferer.model import ModelHandler
from brainles_aurora.utils import remove_path_suffixes
from brainles_aurora.utils.console_decorators import citation_reminder

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -148,6 +149,7 @@ def _configure_device(self) -> torch.device:

return device

@citation_reminder
def infer(
self,
t1: str | Path | np.ndarray | None = None,
Expand Down
22 changes: 22 additions & 0 deletions brainles_aurora/utils/console_decorators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from rich.console import Console

CITATION_LINK = "https://github.com/BrainLesion/AURORA#citation"


def citation_reminder(func):
def wrapper(*args, **kwargs):
console = Console()
console.rule("Thank you for using [bold]AURORA[/bold]")
console.print(
f"Please support our development by citing the papers listed here:",
justify="center",
)
console.print(
f"{CITATION_LINK} -- Thank you!",
justify="center",
)
console.rule()
console.line()
func(*args, **kwargs)

return wrapper
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ numpy = ">=1.23.0"
tqdm = "^4.64.1"
path = "^16.2.0"
requests =">=2.0.0"
rich = ">=13.0.0"

[tool.poetry.dev-dependencies]
pytest = "^6.2"
Expand Down

0 comments on commit 0fb38b0

Please sign in to comment.