Files
Runware-ComfyUI-Runware/modules/briaImageProviderSettings.py
T
Sirshendu Ganguly 843422e01c Add provider settings support and new input nodes for upscale/background removal
- Add Ovi/Bria provider settings support for upscaler and background removal
- Add new Safety Inputs node (modules/safetyInputs.py) for content moderation settings
- Add new Video Advanced Feature Inputs node (modules/videoAdvancedFeatureInputs.py) for CFG scales, negative prompts, and SLG layer settings
- Fix advanced feature inputs to be properly nested under 'advancedFeatures' key (matching safety inputs pattern)
- Update bgremoval.py with provider settings support
- Update upscaler.py with provider settings support
- Update videoInference.py to handle safety and advanced feature inputs correctly
- Update acceleratorOptions.py with improved caching options
- Update briaImageProviderSettings.py with additional settings
- Update videoInferenceInputs.py with new input support
- Update videoModelSearch.py with model enhancements
- Update all workflow JSON files to use new nodes
- Add new Runware_Image_to_Video_Ovi.json workflow
- Update TypeScript types in clientlibs/types.js
- Register new nodes in __init__.py
2025-10-28 23:09:47 -04:00

123 lines
5.0 KiB
Python

"""
Runware Bria Image Provider Settings Node
Provides Bria-specific settings for image generation
"""
import torch
from typing import Optional, Dict, Any
class RunwareBriaProviderSettings:
"""Runware Bria Image Provider Settings Node"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {},
"optional": {
"medium": (["None", "photography", "art"], {
"tooltip": "Select the medium type for image generation",
"default": "photography",
}),
"promptEnhancement": ("BOOLEAN", {
"tooltip": "When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images. Note that turning this flag on may result in a few additional seconds to the inference time.",
"default": False,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"enhanceImage": ("BOOLEAN", {
"tooltip": "When set to true, generates images with richer details, sharper textures, and enhanced clarity. Slightly increases generation time per image.",
"default": False,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"promptContentModeration": ("BOOLEAN", {
"tooltip": "When enabled (default: true), the input prompt is scanned for NSFW or ethically restricted terms before image generation. If the prompt violates Bria's ethical guidelines, the request will be rejected with a 408 error.",
"default": True,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"contentModeration": ("BOOLEAN", {
"tooltip": "When enabled, applies content moderation to both input visuals and generated outputs.",
"default": True,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"ipSignal": ("BOOLEAN", {
"tooltip": "Flags prompts with potential IP content. If detected, a warning will be included in the response.",
"default": False,
"label_on": "Enabled",
"label_off": "Disabled",
}),
"preserveAlpha": ("BOOLEAN", {
"tooltip": "Preserve alpha channel in the image.",
"default": None,
"label_on": "Enabled",
"label_off": "Disabled",
}),
}
}
RETURN_TYPES = ("RUNWAREPROVIDERSETTINGS",)
RETURN_NAMES = ("providerSettings",)
FUNCTION = "create_provider_settings"
CATEGORY = "Runware/Provider Settings"
DESCRIPTION = "Configure Bria-specific provider settings for image generation including medium type, prompt enhancement, image enhancement, and content moderation options."
def create_provider_settings(self, **kwargs) -> tuple[Dict[str, Any]]:
"""Create Bria provider settings"""
# Get parameters
medium = kwargs.get("medium", "photography")
promptEnhancement = kwargs.get("promptEnhancement", False)
enhanceImage = kwargs.get("enhanceImage", False)
promptContentModeration = kwargs.get("promptContentModeration", True)
contentModeration = kwargs.get("contentModeration", True)
ipSignal = kwargs.get("ipSignal", False)
preserveAlpha = kwargs.get("preserveAlpha", None)
# Build settings dictionary
settings = {}
# Add medium
if medium is not None and medium != "None":
settings["medium"] = medium
# Add promptEnhancement
if promptEnhancement is not None:
settings["promptEnhancement"] = promptEnhancement
# Add enhanceImage
if enhanceImage is not None:
settings["enhanceImage"] = enhanceImage
# Add promptContentModeration
if promptContentModeration is not None:
settings["promptContentModeration"] = promptContentModeration
# Add contentModeration
if contentModeration is not None:
settings["contentModeration"] = contentModeration
# Add ipSignal
if ipSignal is not None:
settings["ipSignal"] = ipSignal
# Add preserveAlpha
if preserveAlpha is not None:
settings["preserveAlpha"] = preserveAlpha
# Clean up None values
settings = {k: v for k, v in settings.items() if v is not None}
return (settings,)
# Node class mappings
NODE_CLASS_MAPPINGS = {
"RunwareBriaProviderSettings": RunwareBriaProviderSettings,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"RunwareBriaProviderSettings": "Runware Bria Provider Settings",
}