GeezerVison is showing github.com — feat: add colorize() (v0.1.0) — DDColor image colorization · useknockout/python@e9cc90b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: pyproject.toml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build" | 4 | 4 |
| 5 | 5 | [project] | 6 | 6 | name = "useknockout" | 7 | | -version = "0.0.4" | | 7 | +version = "0.1.0" | 8 | 8 | description = "Python SDK for useknockout — state-of-the-art background removal API." | 9 | 9 | readme = "README.md" | 10 | 10 | license = { text = "MIT" } | |
Collapse file Copy file name to clipboard +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -__version__ = "0.0.4" | | 1 | +__version__ = "0.1.0" |
Collapse file Copy file name to clipboardExpand all lines: src/useknockout/async_client.py +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -362,3 +362,17 @@ async def face_restore( | 362 | 362 | files=_multipart_files(file), | 363 | 363 | data=_form({"only_center_face": only_center_face, "format": format}), | 364 | 364 | ) | | 365 | + | | 366 | + async def colorize( | | 367 | + self, | | 368 | + file: FileInput, | | 369 | + *, | | 370 | + format: str = "png", | | 371 | + ) -> bytes: | | 372 | + """POST /colorize — DDColor (Apache-2.0) image colorization. Async.""" | | 373 | + return await self._request_bytes( | | 374 | + "POST", | | 375 | + "/colorize", | | 376 | + files=_multipart_files(file), | | 377 | + data=_form({"format": format}), | | 378 | + ) |
Collapse file Copy file name to clipboardExpand all lines: src/useknockout/client.py +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -403,3 +403,25 @@ def face_restore( | 403 | 403 | files=_multipart_files(file), | 404 | 404 | data=_form({"only_center_face": only_center_face, "format": format}), | 405 | 405 | ) | | 406 | + | | 407 | + def colorize( | | 408 | + self, | | 409 | + file: FileInput, | | 410 | + *, | | 411 | + format: str = "png", | | 412 | + ) -> bytes: | | 413 | + """POST /colorize — DDColor (Apache-2.0) image colorization. | | 414 | +
| | 415 | + Predicts plausible color from grayscale luminance via a ConvNeXt-Large | | 416 | + backbone (single feed-forward, ~500ms warm). Works on B&W or color | | 417 | + input — color images are converted to grayscale internally before | | 418 | + prediction, which makes round-trip recoloring straightforward. | | 419 | +
| | 420 | + Added in v0.1.0; requires API ≥ v0.7.0. | | 421 | + """ | | 422 | + return self._request_bytes( | | 423 | + "POST", | | 424 | + "/colorize", | | 425 | + files=_multipart_files(file), | | 426 | + data=_form({"format": format}), | | 427 | + ) |
|