Repository navigation
Keep detect wrapper status messages separate from JSON stdout - #36
Open
Anish Pentyala (anishpentyala) wants to merge 4 commits into
Open
Anish Pentyala (anishpentyala) wants to merge 4 commits into
Anish Pentyala (anishpentyala) wants to merge 4 commits into
Conversation
|
Anish Pentyala (@anishpentyala) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This branch has not been deployed
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
Keep the detect wrapper's JSON output separate from its status messages:
The default no-output-file path currently prints prose before and after the JSON list, so piping stdout to a JSON reader fails. The same messages remain visible in a terminal after this change. This is the wrapper-level fix discussed by email and invited for a PR.
Verification
Same six tests on upstream base
a2e55e900dea8808f6b94ec84dc6decacb49107a: five failures and one pass. Fresh public candidateba40e3e9eb4016abb55441acd624f836893a7824: all three changed files match the tested candidate, and six tests pass on local Python3.9-3.14. Cases cover single-image/directory input, stdout/output-file results, preserved model arguments, and missing/empty input errors. These are six test cases, not six different bugs.The tests load the real CLI source module and replace only the model boundary with a placeholder. They need pytest but do not import PyTorch-Wildlife, download weights, use a GPU or run real inference. Run from the repository root:
No claim is made about model accuracy or full installed-framework behavior. Underlying models/frameworks may print their own stdout; this patch only controls messages emitted by this wrapper. The docs retain
--outputas the safer option for a backend that prints its own output.AI assistance
This implementation, tests, documentation and PR description were prepared with AI assistance on Anish's behalf. No personal review by Anish or unassisted authorship is claimed. Maintainer review and any contribution agreement remain separate steps.