Add Modal.com GPU server for nnInteractive v2 + fix macOS pip crash - #98
Draft
pieper wants to merge 4 commits into
Draft
Add Modal.com GPU server for nnInteractive v2 + fix macOS pip crash#98pieper wants to merge 4 commits into
pieper wants to merge 4 commits into
Conversation
Contributor
Author
|
Addresses #96 |
slicer.util.pip_install called from a background thread triggers Qt dialog creation off the main thread, which crashes on macOS because NSWindow must be created on the main thread. Run pip directly via subprocess.check_call on the main thread instead. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
modal_app.py is a drop-in replacement for the local server at port 1527. Key changes from the upstream v1 server: - nninteractive upgraded 1.0.1 → 2.4.2 - use_pinned_memory replaced by interactions_storage='auto' - interaction_bbox added to lasso/scribble calls (3-orders-of-magnitude speedup) - /health and /reset endpoints added - Model weights cached in a persistent Modal Volume (no re-download on restart) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
conda create with --override-channels does not install pip by default; adding it explicitly ensures the subsequent pip uninstall/install steps can run. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
pieper
force-pushed
the
nninteractive-v2-modal
branch
from
June 29, 2026 21:55
e7d2bbb to
86a3ecb
Compare
pieper
marked this pull request as draft
June 29, 2026 22:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
server/modal_app.py— new Modal.com deployment that serves nnInteractive v2 as a drop-in replacement for the local server at port 1527. Point the Slicer extension at the Modal URL instead ofhttp://localhost:1527.SlicerNNInteractive.py— fix macOS crash when installing dependencies:slicer.util.pip_installcreates Qt dialogs from a background thread, which crashes on macOS becauseNSWindowmust be created on the main thread. Replaced withsubprocess.check_callrunning pip directly on the main thread.Modal server changes from the upstream v1 server
1.0.1 → 2.4.2use_pinned_memoryremoved (replaced byinteractions_storage='auto'in v2)interaction_bboxadded to lasso/scribble calls (~1000x speedup by limiting inference to the drawn region)/healthand/resetendpoints addedcontainer_idle_timeout=360keeps the container alive during a sessionallow_concurrent_inputs=1serializes requests to protect in-memory session stateBackward compatibility
The HTTP API shape is identical between the v1 and v2 servers — all existing endpoints (
/upload_image,/upload_segment,/add_point_interaction,/add_bbox_interaction,/add_lasso_interaction,/add_scribble_interaction) use the same request/response formats. The Slicer plugin works unchanged against either server.Test plan
modal serve server/modal_app.pystarts without errorsmodal deploy server/modal_app.pyproduces a persistent URL🤖 Generated with Claude Code