Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

31 feature request citation reminder #39

Merged
merged 5 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading