Hotfix for Issue #2

Updated node to fix "Folder_paths", corrected init.py to remove inactive nodes and updated requirements.txt to add colorama
This commit is contained in:
tusharbhutt
2023-10-03 17:03:30 -06:00
committed by GitHub
parent 80783644a3
commit e3fbba6edd
3 changed files with 44 additions and 43 deletions

View File

@@ -15,11 +15,11 @@ NODE_CLASS_MAPPINGS = {
"Endless Nodes Parameterizer & Prompts": EndlessNode_XLParameterizerPrompt, "Endless Nodes Parameterizer & Prompts": EndlessNode_XLParameterizerPrompt,
"Endless Nodes Combo Parameterizer": EndlessNode_ComboXLParameterizer, "Endless Nodes Combo Parameterizer": EndlessNode_ComboXLParameterizer,
"Endless Nodes Combo Parameterizer & Prompts": EndlessNode_ComboXLParameterizerPrompt, "Endless Nodes Combo Parameterizer & Prompts": EndlessNode_ComboXLParameterizerPrompt,
"Endless Nodes Image Save with Text File": EndlessNode_ImageSaver, "Endless Nodes Image Saver with JSON": EndlessNode_ImageSaver,
"Endless Nodes Aesthetic Scoring": EndlessNode_Scoring, "Endless Nodes Aesthetic Scoring": EndlessNode_Scoring,
"Endless Nodes Aesthetic Scoring Auto": EndlessNode_ScoringAutoScore, # "Endless Nodes Aesthetic Scoring Auto": EndlessNode_ScoringAutoScore,
"Endless Nodes Image Reward": EndlessNode_ImageReward, "Endless Nodes Image Reward": EndlessNode_ImageReward,
"Endless Nodes Image Reward Auto": EndlessNode_ImageRewardAutoScore, # "Endless Nodes Image Reward Auto": EndlessNode_ImageRewardAutoScore,
"Endless Nodes Float to Integer": EndlessNode_FloattoInt, "Endless Nodes Float to Integer": EndlessNode_FloattoInt,
"Endless Nodes Float to Number": EndlessNode_FloattoNum, "Endless Nodes Float to Number": EndlessNode_FloattoNum,
"Endless Nodes Float to String": EndlessNode_FloattoString, "Endless Nodes Float to String": EndlessNode_FloattoString,
@@ -29,9 +29,9 @@ NODE_CLASS_MAPPINGS = {
"Endless Nodes Integer to Float": EndlessNode_InttoFloat, "Endless Nodes Integer to Float": EndlessNode_InttoFloat,
"Endless Nodes Integer to Number": EndlessNode_InttoNum, "Endless Nodes Integer to Number": EndlessNode_InttoNum,
"Endless Nodes Integer to String": EndlessNode_InttoString, "Endless Nodes Integer to String": EndlessNode_InttoString,
"Endless Nodes Float to X": EndlessNode_FloattoX, # "Endless Nodes Float to X": EndlessNode_FloattoX,
"Endless Nodes Integer to X": EndlessNode_InttoX, # "Endless Nodes Integer to X": EndlessNode_InttoX,
"Endless Nodes Number to X": EndlessNode_NumtoX, # "Endless Nodes Number to X": EndlessNode_NumtoX,
} }

View File

@@ -34,7 +34,7 @@ import ImageReward as RM
import clip import clip
import colorama import colorama
import datetime import datetime
import folder_paths as endless_paths import folder_paths
import io import io
import json import json
import math import math
@@ -559,49 +559,49 @@ class EndlessNode_ImageReward:
return (score, str(score), valuescale, str(valuescale)) return (score, str(score), valuescale, str(valuescale))
# #---------------------------------------------- NOT WORKING, NEED TO LOOK AT #---------------------------------------------- NOT WORKING, NEED TO LOOK AT
# # Image Reward Scoring with score passed to image # Image Reward Scoring with score passed to image
# class EndlessNode_ImageRewardAutoScore: class EndlessNode_ImageRewardAutoScore:
# def __init__(self): def __init__(self):
# self.model = None self.model = None
# @classmethod @classmethod
# def INPUT_TYPES(cls): def INPUT_TYPES(cls):
# return { return {
# "required": { "required": {
# "model": ("STRING", {"multiline": False, "default": "ImageReward-v1.0"}), "model": ("STRING", {"multiline": False, "default": "ImageReward-v1.0"}),
# "prompt": ("STRING", {"multiline": True, "forceInput": True}), "prompt": ("STRING", {"multiline": True, "forceInput": True}),
# "images": ("IMAGE",), "images": ("IMAGE",),
# }, },
# } }
# RETURN_TYPES = ("FLOAT", "STRING", "FLOAT", "STRING", "IMAGE") RETURN_TYPES = ("FLOAT", "STRING", "FLOAT", "STRING", "IMAGE")
# RETURN_NAMES = ("SCORE_FLOAT", "SCORE_STRING", "VALUE_FLOAT", "VALUE_STRING", "TO_IMAGE") RETURN_NAMES = ("SCORE_FLOAT", "SCORE_STRING", "VALUE_FLOAT", "VALUE_STRING", "TO_IMAGE")
# OUTPUT_NODE = True OUTPUT_NODE = True
# CATEGORY = "Endless 🌌/Scoring" CATEGORY = "Endless 🌌/Scoring"
# FUNCTION = "score_meta" FUNCTION = "score_meta"
# def score_meta(self, model, prompt, images): def score_meta(self, model, prompt, images):
# if self.model is None: if self.model is None:
# self.model = RM.load(model) self.model = RM.load(model)
# # Scoring part # Scoring part
# score = 0.0 score = 0.0
# for image in images: for image in images:
# i = 255.0 * image.cpu().numpy() i = 255.0 * image.cpu().numpy()
# img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
# score += self.model.score(prompt, [img]) score += self.model.score(prompt, [img])
# score /= len(images) score /= len(images)
# valuescale = 0.5 * (1 + math.erf(score / math.sqrt(2))) * 10 valuescale = 0.5 * (1 + math.erf(score / math.sqrt(2))) * 10
# # Metadata part # Metadata part
# extra_pnginfo = {"SCORE": str(score)} extra_pnginfo = {"SCORE": str(score)}
# # Returning both the score and the modified image # Returning both the score and the modified image
# return (score, str(score), valuescale, str(valuescale), images) return (score, str(score), valuescale, str(valuescale), images)
# ______________________________________________________________________________________________________________________________________________________________ # ______________________________________________________________________________________________________________________________________________________________
# IMAGE SAVERS BLOCK # # IMAGE SAVERS BLOCK #
@@ -612,7 +612,7 @@ class EndlessNode_ImageReward:
class EndlessNode_ImageSaver: class EndlessNode_ImageSaver:
def __init__(self): def __init__(self):
self.output_dir = endless_paths.get_output_directory() self.output_dir = folder_paths.get_output_directory()
self.type = "output" self.type = "output"
@classmethod @classmethod

View File

@@ -1,3 +1,4 @@
clip clip
pytorch-lightning pytorch-lightning
image-reward==1.4 image-reward==1.4
colorama