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.
- {useknockout-0.0.3 → useknockout-0.0.4}/PKG-INFO +1 -1
- {useknockout-0.0.3 → useknockout-0.0.4}/pyproject.toml +1 -1
- useknockout-0.0.4/src/useknockout/_version.py +1 -0
- {useknockout-0.0.3 → useknockout-0.0.4}/src/useknockout/async_client.py +9 -1
- {useknockout-0.0.3 → useknockout-0.0.4}/src/useknockout/client.py +13 -4
- useknockout-0.0.3/src/useknockout/_version.py +0 -1
- {useknockout-0.0.3 → useknockout-0.0.4}/.gitignore +0 -0
- {useknockout-0.0.3 → useknockout-0.0.4}/LICENSE +0 -0
- {useknockout-0.0.3 → useknockout-0.0.4}/README.md +0 -0
- {useknockout-0.0.3 → useknockout-0.0.4}/src/useknockout/__init__.py +0 -0
- {useknockout-0.0.3 → useknockout-0.0.4}/src/useknockout/_helpers.py +0 -0
- {useknockout-0.0.3 → useknockout-0.0.4}/src/useknockout/errors.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: useknockout
|
|
3
|
-
Version: 0.0.
|
|
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
|
|
@@ -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({
|
|
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 —
|
|
365
|
+
"""POST /upscale — 2x/4x super-resolution.
|
|
365
366
|
|
|
366
|
-
``
|
|
367
|
-
|
|
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({
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|