Skip to content

Commit

Permalink
Merge branch 'main' into misc/wiki-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
oumad authored Jan 5, 2025
2 parents e6981d6 + 204a567 commit d9ac50c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
11 changes: 9 additions & 2 deletions backend/src/packages/chaiNNer_onnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from api import KB, MB, Dependency, add_package
from gpu import nvidia
from system import is_arm_mac
from system import is_arm_mac, is_windows

general = "ONNX uses .onnx models to upscale images."
conversion = "It also helps to convert between PyTorch and NCNN."
Expand All @@ -15,7 +15,7 @@
f"{general} {conversion} It is fastest when CUDA is supported. If TensorRT is"
" installed on the system, it can also be configured to use that."
)
inst_hint = f"{general} It does not support AMD GPUs."
inst_hint = f"{general} It does not support AMD GPUs, in linux."


def get_onnx_runtime():
Expand All @@ -28,6 +28,13 @@ def get_onnx_runtime():
import_name="onnxruntime",
extra_index_url="https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/",
)
elif is_windows:
return Dependency(
display_name="ONNX Runtime (DirectMl)",
pypi_name="onnxruntime-directml",
version="1.17.1",
size_estimate=15 * MB,
)
else:
return Dependency(
display_name="ONNX Runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ class NoiseType(Enum):
NoiseColor.GRAY: "Monochrome",
},
),
SliderInput("Amount", min=0, max=100, default=50),
SliderInput(
"Amount",
min=0.0,
max=100.0,
default=50.0,
precision=1,
step=0.1,
slider_step=0.1,
),
seed_group(SeedInput()),
],
outputs=[
Expand All @@ -67,18 +75,18 @@ def add_noise_node(
img: np.ndarray,
noise_type: NoiseType,
noise_color: NoiseColor,
amount: int,
amount: float,
seed: Seed,
) -> np.ndarray:
if noise_type == NoiseType.GAUSSIAN:
return gaussian_noise(img, amount / 100, noise_color, seed.value)
return gaussian_noise(img, amount / 100.0, noise_color, seed.value)
elif noise_type == NoiseType.UNIFORM:
return uniform_noise(img, amount / 100, noise_color, seed.value)
return uniform_noise(img, amount / 100.0, noise_color, seed.value)
elif noise_type == NoiseType.SALT_AND_PEPPER:
return salt_and_pepper_noise(img, amount / 100, noise_color, seed.value)
return salt_and_pepper_noise(img, amount / 100.0, noise_color, seed.value)
elif noise_type == NoiseType.POISSON:
return poisson_noise(img, amount / 100, noise_color, seed.value)
return poisson_noise(img, amount / 100.0, noise_color, seed.value)
elif noise_type == NoiseType.SPECKLE:
return speckle_noise(img, amount / 100, noise_color, seed.value)
return speckle_noise(img, amount / 100.0, noise_color, seed.value)
else:
raise ValueError(f"Unknown noise type: {noise_type}")
23 changes: 13 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"reactflow": "^11.10.1",
"rregex": "^1.10.11",
"semver": "^7.3.7",
"systeminformation": "^5.21.7",
"systeminformation": "^5.23.8",
"use-context-selector": "^1.4.0",
"use-debounce": "^8.0.1",
"uuid": "^8.3.2",
Expand Down

0 comments on commit d9ac50c

Please sign in to comment.