Skip to content

Commit

Permalink
fix(api): correctly disable source filtering when none is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Apr 22, 2023
1 parent 348421d commit eeaba37
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions api/onnx_web/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
source_filter_hed,
source_filter_mlsd,
source_filter_noise,
source_filter_none,
source_filter_normal,
source_filter_openpose,
source_filter_scribble,
Expand Down
7 changes: 7 additions & 0 deletions api/onnx_web/image/source_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def filter_model_path(server: ServerContext, filter_name: str) -> str:
return path.join(server.model_path, "filter", filter_name)


def source_filter_none(
server: ServerContext,
source: Image.Image,
):
return source


def source_filter_gaussian(
server: ServerContext,
source: Image.Image,
Expand Down
16 changes: 9 additions & 7 deletions api/onnx_web/server/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
source_filter_hed,
source_filter_mlsd,
source_filter_noise,
source_filter_none,
source_filter_normal,
source_filter_openpose,
source_filter_scribble,
Expand Down Expand Up @@ -68,17 +69,18 @@
"rocm": "ROCMExecutionProvider",
}
source_filters = {
"gaussian": source_filter_gaussian,
"noise": source_filter_noise,
"canny": source_filter_canny,
"depth": source_filter_depth,
"face": source_filter_face,
"segment": source_filter_segment,
"gaussian": source_filter_gaussian,
"hed": source_filter_hed,
"mlsd": source_filter_mlsd,
"noise": source_filter_noise,
"none": source_filter_none,
"normal": source_filter_normal,
"hed": source_filter_hed,
"scribble": source_filter_scribble,
"depth": source_filter_depth,
"canny": source_filter_canny,
"openpose": source_filter_openpose,
"segment": source_filter_segment,
"scribble": source_filter_scribble,
}

# Available ORT providers
Expand Down

0 comments on commit eeaba37

Please sign in to comment.