cog
0a493200 - Refactor `cog predict` to support `--json` flag (#2404)

Commit
197 days ago
Refactor `cog predict` to support `--json` flag (#2404) * Implement `cog predict --json` This allows `cog predict` to use JSON as the input/output format which makes it more suitable for automation such as testing. * Support writing output file to disk * Refactor to use same path for output processing * Cleanup `--output` flag * Rename write methods * Always transform outputs * Clean up display of outputs in cog predict * Preserve file extensions on `list[Path]` outputs * Only transform outputs if the prediction was successful * Exit from `cog predict` with non-zero exit code if prediction fails * DEBUG * DEBUG * Fix adding double file extension * Fix checking if the extension is an integer * Add test_predict_json_input integration test * Add more integration tests * Support - for stdin input * Use %q for output name format * Send error if prediction status fails * Fix flaky file challenge test * Fix integration tests * Remove newline * Just test output file in output mode --------- Co-authored-by: Will Sackfield <sackfield@replicate.com>
Author
Parents
Loading