useknockout 0.0.3__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: useknockout
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Python SDK for useknockout — state-of-the-art background removal API.
5
5
  Project-URL: Homepage, https://useknockout.com
6
6
  Project-URL: Documentation, https://github.com/useknockout/python
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "useknockout"
7
- version = "0.0.3"
7
+ version = "0.0.4"
8
8
  description = "Python SDK for useknockout — state-of-the-art background removal API."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -0,0 +1 @@
1
+ __version__ = "0.0.4"
@@ -329,16 +329,24 @@ class AsyncKnockout:
329
329
  file: FileInput,
330
330
  *,
331
331
  scale: int = 4,
332
+ model: str = "swin2sr",
332
333
  face_enhance: bool = False,
333
334
  format: str = "png",
334
335
  ) -> bytes:
335
336
  if scale not in (2, 4):
336
337
  raise ValueError("scale must be 2 or 4")
338
+ if model not in ("swin2sr", "realesrgan"):
339
+ raise ValueError("model must be 'swin2sr' or 'realesrgan'")
337
340
  return await self._request_bytes(
338
341
  "POST",
339
342
  "/upscale",
340
343
  files=_multipart_files(file),
341
- data=_form({"scale": scale, "face_enhance": face_enhance, "format": format}),
344
+ data=_form({
345
+ "scale": scale,
346
+ "model": model,
347
+ "face_enhance": face_enhance,
348
+ "format": format,
349
+ }),
342
350
  )
343
351
 
344
352
  async def face_restore(
@@ -358,21 +358,30 @@ class Knockout:
358
358
  file: FileInput,
359
359
  *,
360
360
  scale: int = 4,
361
+ model: str = "swin2sr",
361
362
  face_enhance: bool = False,
362
363
  format: str = "png",
363
364
  ) -> bytes:
364
- """POST /upscale — Real-ESRGAN x2/x4 super-resolution.
365
+ """POST /upscale — 2x/4x super-resolution.
365
366
 
366
- ``face_enhance=True`` routes through GFPGAN for sharper facial detail
367
- (slower; use for portraits).
367
+ ``model="swin2sr"`` (default, v0.6.0+) is sharper on real photos.
368
+ ``model="realesrgan"`` is the legacy backend — better on anime / illustrations.
369
+ ``face_enhance=True`` routes through GFPGAN (Real-ESRGAN backend).
368
370
  """
369
371
  if scale not in (2, 4):
370
372
  raise ValueError("scale must be 2 or 4")
373
+ if model not in ("swin2sr", "realesrgan"):
374
+ raise ValueError("model must be 'swin2sr' or 'realesrgan'")
371
375
  return self._request_bytes(
372
376
  "POST",
373
377
  "/upscale",
374
378
  files=_multipart_files(file),
375
- data=_form({"scale": scale, "face_enhance": face_enhance, "format": format}),
379
+ data=_form({
380
+ "scale": scale,
381
+ "model": model,
382
+ "face_enhance": face_enhance,
383
+ "format": format,
384
+ }),
376
385
  )
377
386
 
378
387
  def face_restore(
@@ -1 +0,0 @@
1
- __version__ = "0.0.3"
File without changes
File without changes
File without changes