New node : Video prompt generator
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
import json
|
||||
import random
|
||||
import os
|
||||
|
||||
class VideoPromptGenerator:
|
||||
def __init__(self):
|
||||
self.config_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
"configs", "video_prompt_config.json")
|
||||
self.load_config()
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
try:
|
||||
config_path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
"configs", "video_prompt_config.json")
|
||||
with open(config_path, 'r') as f:
|
||||
config = json.load(f)
|
||||
camera_angles = ["Random"] + config["camera_angles"]
|
||||
lighting_conditions = ["Random"] + config["lighting_conditions"]
|
||||
except Exception as e:
|
||||
print(f"Error loading config for INPUT_TYPES: {e}")
|
||||
camera_angles = ["Random", "The camera remains stationary"]
|
||||
lighting_conditions = ["Random", "with natural lighting"]
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
"custom_subject": ("STRING", {"default": "", "multiline": False}),
|
||||
"custom_location": ("STRING", {"default": "", "multiline": False}),
|
||||
"camera_angle": (camera_angles,),
|
||||
"lighting": (lighting_conditions,),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
FUNCTION = "generate_prompt"
|
||||
CATEGORY = "Isulion/Prompt"
|
||||
|
||||
def load_config(self):
|
||||
try:
|
||||
with open(self.config_path, 'r') as f:
|
||||
self.config = json.load(f)
|
||||
except Exception as e:
|
||||
print(f"Error loading config: {e}")
|
||||
self.config = {
|
||||
"subjects": ["a person"],
|
||||
"locations": ["in a room"],
|
||||
"camera_angles": ["The camera remains stationary"],
|
||||
"lighting_conditions": ["with natural lighting"]
|
||||
}
|
||||
|
||||
def generate_prompt(self, seed, custom_subject="", custom_location="", camera_angle="", lighting=""):
|
||||
# Set random seed for reproducibility
|
||||
rng = random.Random(seed)
|
||||
|
||||
# Use custom values if provided, otherwise use random values
|
||||
subject = custom_subject if custom_subject else rng.choice(self.config["subjects"])
|
||||
|
||||
# Handle location with proper preposition
|
||||
if custom_location:
|
||||
# Check if location already starts with a preposition
|
||||
prepositions = ["in", "at", "near", "by", "inside", "outside"]
|
||||
has_preposition = any(custom_location.lower().startswith(prep) for prep in prepositions)
|
||||
location = custom_location if has_preposition else f"in {custom_location}"
|
||||
else:
|
||||
location = rng.choice(self.config["locations"])
|
||||
|
||||
# Handle camera angle and lighting with Random option
|
||||
camera = rng.choice(self.config["camera_angles"]) if camera_angle == "Random" else camera_angle
|
||||
lighting_condition = rng.choice(self.config["lighting_conditions"]) if lighting == "Random" else lighting
|
||||
|
||||
# Construct a detailed, cinematographic prompt
|
||||
prompt = f"{subject} {location}. "
|
||||
prompt += f"{camera}, capturing the scene as {lighting_condition}. "
|
||||
prompt += "The scene unfolds naturally, with fluid movements and authentic expressions. "
|
||||
prompt += "The overall composition maintains a cinematic quality with attention to detail and depth."
|
||||
|
||||
return (prompt,)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Isulion Video Prompt Generator 🎥": VideoPromptGenerator
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"Isulion Video Prompt Generator 🎥": "Isulion Video Prompt Generator 🎥"
|
||||
}
|
||||
@@ -34,11 +34,13 @@ from .enhancement_nodes.isulion_style_mixer import IsulionStyleMixer
|
||||
from .enhancement_nodes.isulion_prompt_enhancer import IsulionPromptEnhancer
|
||||
from .enhancement_nodes.isulion_negative_prompt_generator import IsulionNegativePromptGenerator
|
||||
from .Core_Nodes.mega_prompt_generator import IsulionMegaPromptGenerator
|
||||
from .Core_Nodes.video_prompt_generator import NODE_CLASS_MAPPINGS as VIDEO_PROMPT_NODES
|
||||
from .isucollage_node import IsuCollageNode
|
||||
from .load_images_node import IsulionLoadImagesNode
|
||||
|
||||
# Node mappings
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
**VIDEO_PROMPT_NODES,
|
||||
"IsulionPromptGenerator": IsulionPromptGenerator,
|
||||
"IsulionAnimalRandom": Isulion_AnimalRandom,
|
||||
"IsulionCuteAnimalRandom": IsulionCuteAnimalRandom,
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
{
|
||||
"subjects": [
|
||||
"a woman with long brown hair",
|
||||
"a man in a business suit",
|
||||
"a police officer",
|
||||
"an elderly person",
|
||||
"a couple",
|
||||
"a group of friends",
|
||||
"a professional athlete",
|
||||
"a musician",
|
||||
"a dancer",
|
||||
"a majestic waterfall",
|
||||
"a vintage car",
|
||||
"a steam locomotive",
|
||||
"a sailing ship",
|
||||
"a flock of birds",
|
||||
"a towering skyscraper",
|
||||
"a medieval castle",
|
||||
"an ancient temple",
|
||||
"a blooming cherry tree",
|
||||
"a rustic windmill",
|
||||
"a snow-covered mountain peak",
|
||||
"a winding river",
|
||||
"a field of wildflowers",
|
||||
"a dense forest",
|
||||
"a desert dune",
|
||||
"a lighthouse",
|
||||
"a hot air balloon",
|
||||
"an old bookstore",
|
||||
"a cozy cafe",
|
||||
"a traditional Japanese garden",
|
||||
"a firefighter in action",
|
||||
"a street artist performing",
|
||||
"a chef preparing a gourmet meal",
|
||||
"a scientist in a laboratory",
|
||||
"a construction worker",
|
||||
"a surfer riding a wave",
|
||||
"a yoga instructor in a pose",
|
||||
"a child playing in a park",
|
||||
"a farmer tending to crops",
|
||||
"a pilot in a cockpit",
|
||||
"a herd of elephants",
|
||||
"a school of colorful fish",
|
||||
"a pack of wolves",
|
||||
"a flock of flamingos",
|
||||
"a colony of penguins",
|
||||
"a space shuttle launch",
|
||||
"a Formula 1 race car",
|
||||
"a luxury yacht",
|
||||
"a helicopter in flight",
|
||||
"a submarine emerging",
|
||||
"a futuristic cityscape",
|
||||
"an underwater coral reef",
|
||||
"a volcanic eruption",
|
||||
"a northern lights display",
|
||||
"a tropical beach at sunset",
|
||||
"a bustling night market",
|
||||
"a serene zen garden",
|
||||
"a vibrant street mural",
|
||||
"an ice sculpture exhibition",
|
||||
"a traditional tea ceremony"
|
||||
],
|
||||
"locations": [
|
||||
"in a dimly lit room",
|
||||
"on a busy city street",
|
||||
"in a peaceful garden",
|
||||
"at a bustling cafe",
|
||||
"on a mountain top",
|
||||
"by the ocean",
|
||||
"in a modern office",
|
||||
"in a historic building",
|
||||
"in a park",
|
||||
"at a train station",
|
||||
"near a misty lake",
|
||||
"in a dense forest",
|
||||
"at the edge of a cliff",
|
||||
"in a desert oasis",
|
||||
"among ancient ruins",
|
||||
"in a vibrant marketplace",
|
||||
"beside a flowing river",
|
||||
"in a snow-covered valley",
|
||||
"at a coastal harbor",
|
||||
"in a hidden cave",
|
||||
"on a secluded beach",
|
||||
"in a sprawling vineyard",
|
||||
"atop a skyscraper",
|
||||
"in an underground bunker",
|
||||
"at a serene temple",
|
||||
"in a colorful hot air balloon",
|
||||
"on a desert highway",
|
||||
"in a lush rainforest",
|
||||
"at an abandoned amusement park",
|
||||
"in a cozy log cabin",
|
||||
"on a futuristic space station",
|
||||
"in a traditional village",
|
||||
"at a bustling airport",
|
||||
"in a tranquil zen garden",
|
||||
"on a remote island",
|
||||
"in a bustling farmer's market",
|
||||
"at a grand concert hall",
|
||||
"in a mysterious fog-covered moor",
|
||||
"on a winding mountain road",
|
||||
"in a sunflower field"
|
||||
],
|
||||
"camera_angles": [
|
||||
"The camera remains stationary",
|
||||
"The camera pans slowly",
|
||||
"The camera follows the subject",
|
||||
"The camera zooms in gradually",
|
||||
"The camera circles around",
|
||||
"The camera moves from left to right",
|
||||
"The camera captures from a low angle",
|
||||
"The camera shoots from above",
|
||||
"The camera tracks backward",
|
||||
"The camera moves in for a close-up",
|
||||
"The camera glides smoothly",
|
||||
"The camera sweeps across",
|
||||
"The camera rises upward",
|
||||
"The camera descends slowly",
|
||||
"The camera spirals around"
|
||||
],
|
||||
"lighting_conditions": [
|
||||
"natural sunlight streams through windows",
|
||||
"warm artificial lighting creates a cozy atmosphere",
|
||||
"harsh fluorescent lights illuminate the space",
|
||||
"soft ambient lighting fills the room",
|
||||
"dramatic shadows create contrast",
|
||||
"golden hour sunlight bathes the scene",
|
||||
"moody low-key lighting",
|
||||
"bright and even lighting",
|
||||
"dappled light filtering through trees",
|
||||
"cool blue evening light",
|
||||
"misty morning light creates a dreamy atmosphere",
|
||||
"dramatic storm clouds cast shifting shadows",
|
||||
"moonlight casts a silvery glow",
|
||||
"neon lights create vibrant color contrasts",
|
||||
"candlelight flickers softly",
|
||||
"sunrise paints the sky in pastel hues",
|
||||
"sunset creates long dramatic shadows",
|
||||
"starlight twinkles in the darkness",
|
||||
"fog diffuses the light mysteriously",
|
||||
"rainbow light refracts through crystal"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user