1
0
Fork 0

more lint

This commit is contained in:
Sean Sube 2024-01-12 23:41:16 -06:00
parent 1cf8c7eff6
commit 065df23902
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 23 additions and 9 deletions

View File

@ -26,7 +26,11 @@ class TileCallback(Protocol):
""" """
def __call__( def __call__(
self, sources: List[Image.Image], mask: Image.Image, dims: Tuple[int, int, int], progress: Tuple[int, int] self,
sources: List[Image.Image],
mask: Image.Image,
dims: Tuple[int, int, int],
progress: Tuple[int, int],
) -> StageResult: ) -> StageResult:
""" """
Run this stage against a single tile. Run this stage against a single tile.
@ -273,9 +277,7 @@ def process_tile_stack(
single_tile = total_tiles == 1 single_tile = total_tiles == 1
for counter, (left, top) in enumerate(tile_coords): for counter, (left, top) in enumerate(tile_coords):
logger.info( logger.info("processing tile %s of %s, %sx%s", counter, total_tiles, left, top)
"processing tile %s of %s, %sx%s", counter, total_tiles, left, top
)
right = left + tile right = left + tile
bottom = top + tile bottom = top + tile
@ -343,7 +345,9 @@ def process_tile_stack(
tile_mask = mask.crop((left, top, right, bottom)) tile_mask = mask.crop((left, top, right, bottom))
for image_filter in filters: for image_filter in filters:
tile_stack = image_filter(tile_stack, tile_mask, (left, top, tile), (counter, total_tiles)) tile_stack = image_filter(
tile_stack, tile_mask, (left, top, tile), (counter, total_tiles)
)
# TODO: this should be inverted to extract them from the result # TODO: this should be inverted to extract them from the result
if isinstance(tile_stack, list): if isinstance(tile_stack, list):

View File

@ -160,7 +160,7 @@ def image_reply(
return data return data
def multi_image_reply(results: Dict[str, Any]): def multi_image_reply(results: List[Dict[str, Any]]):
return jsonify( return jsonify(
{ {
"results": results, "results": results,
@ -180,7 +180,10 @@ def introspect(server: ServerContext, app: Flask):
return { return {
"name": "onnx-web", "name": "onnx-web",
"routes": [ "routes": [
{"path": url_from_rule(rule), "methods": list(rule.methods or []).sort()} {
"path": url_from_rule(rule),
"methods": list(rule.methods or []),
}
for rule in app.url_map.iter_rules() for rule in app.url_map.iter_rules()
], ],
} }
@ -687,7 +690,7 @@ def job_status(server: ServerContext, pool: DevicePoolExecutor):
outputs = None outputs = None
metadata = None metadata = None
if progress.result is not None and len(progress.result) > 0: if progress.result is not None and len(progress.result) > 0:
# TODO: the names should be attached to the result somehow rather than recomputing them # TODO: the names should be attached to the result when it is saved rather than recomputing them
outputs = make_output_names(server, job_name, len(progress.result)) outputs = make_output_names(server, job_name, len(progress.result))
metadata = progress.result.metadata metadata = progress.result.metadata

View File

@ -1,6 +1,13 @@
import { RetryParams } from './api.js'; import { RetryParams } from './api.js';
import { BaseImgParams, HighresParams, Img2ImgParams, InpaintParams, Txt2ImgParams, UpscaleParams } from './params.js'; import { BaseImgParams, HighresParams, Img2ImgParams, InpaintParams, Txt2ImgParams, UpscaleParams } from './params.js';
export interface Border {
left: number;
right: number;
top: number;
bottom: number;
}
export interface Progress { export interface Progress {
current: number; current: number;
total: number; total: number;
@ -26,7 +33,7 @@ export interface ImageMetadata<TParams extends BaseImgParams, TType extends JobT
loras: Array<NetworkMetadata>; loras: Array<NetworkMetadata>;
models: Array<NetworkMetadata>; models: Array<NetworkMetadata>;
border: unknown; // TODO: type border: Border;
highres: HighresParams; highres: HighresParams;
upscale: UpscaleParams; upscale: UpscaleParams;
size: Size; size: Size;