Guest User

Untitled

a guest
Feb 20th, 2025
39
0
72 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. import importlib
  2. parse_prompt_schedules = importlib.import_module("custom_nodes.comfyui-prompt-control.prompt_control.parser").parse_prompt_schedules
  3.  
  4. class PCExtractScheduledPrompt
  5.     @classmethod
  6.     def INPUT_TYPES(cls):
  7.         return {
  8.             "required": {
  9.                 "text": ("STRING", {"multiline": True}),
  10.                 "timestep": ("FLOAT", {"min": 0.0, "max": 1.0, "default": 1.0, "step": 0.01}),
  11.             }
  12.         }
  13.  
  14.     RETURN_TYPES = ("STRING",)
  15.     CATEGORY = "promptcontrol/tools"
  16.     FUNCTION = "apply"
  17.  
  18.     def apply(self, text, timestep):
  19.         schedule = parse_prompt_schedules(text)
  20.         _, entry = schedule.at_step(timestep, total_steps=1)
  21.         prompt_text = entry.get("prompt", "")
  22.         return (prompt_text,)
  23.  
  24. NODE_CLASS_MAPPINGS = {
  25.     "PCExtractScheduledPrompt": PCExtractScheduledPrompt
  26. }
  27.  
  28. NODE_DISPLAY_NAME_MAPPINGS = {
  29.     "PCExtractScheduledPrompt": "PC: Extract Scheduled Prompt",
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment