Add internal server option to avoid asking users to set up a server manually#95
Add internal server option to avoid asking users to set up a server manually#95lassoan wants to merge 2 commits into
Conversation
On Windows and Linux, user no longer has to set up anything manually. The server is automatically installed in 3D Slicer's Python environment and started when needed.
DOWNLOAD_DIR now defaults to ~/.nninteractive_weights instead of a relative path that resolved inside the installation folder. This saves storage space (when multiple Slicer instances are installed), shortens reinstallation time, and allows installation in the future on macOS. This is the pattern that is used by other extensions, such as TotalSegmentator and MONAIAuto3DSeg. PromptManager cretion is deferred until the FastAPI startup event so the new --weights-dir CLI argument is applied before weights are downloaded.
|
Tested on Linux (NVIDIA GPU, Slicer Preview) and hit a chain of subprocess crashes on first use. After installing the NNUNet extension via Extensions Manager and clicking a prompt: After fixing torch manually, retrying produced: Four issues I think are worth addressing — all variations of the same root cause (the dep-install chain isn't atomic and isn't verified before
Workaround for anyone hitting this in the meantime — from the Slicer Python console: from SlicerNNUNetLib import InstallLogic
InstallLogic().setupPythonRequirements()
import slicer
slicer.util.pip_install("nnInteractive>=1.1.5 uvicorn xxhash fastapi python-multipart huggingface_hub")
import torch, uvicorn, fastapi, nnInteractive # sanity checkThen click a prompt tool (not Start Server) and the subprocess should come up cleanly. Otherwise the feature works great — server bundling, log streaming into the Configuration tab, and the internal/external toggle all behave as advertised. Thanks for the work on this. |
This pull request automatically sets up and starts/stops the nnInteractive server and all its dependencies on compatible computers. The user can simply install the Slicer extension and start segmenting.