Promts reload
This commit is contained in:
+5
-1
@@ -12,6 +12,10 @@
|
||||
{
|
||||
"name": "Positive Pony Explicit",
|
||||
"prompt": "(score_9, score_8_up, score_7_up, score_6_up, source_anime, BREAK, rating_explicit, uncensored:1.1)"
|
||||
},
|
||||
{
|
||||
"name": "Positive Pony Realistic",
|
||||
"prompt": "(score_9, score_8_up, score_7_up, score_6_up, photo \\(medium\\), BREAK:1.1)"
|
||||
}
|
||||
],
|
||||
"negative": [
|
||||
@@ -30,7 +34,7 @@
|
||||
|
||||
{
|
||||
"name": "Negative Pony",
|
||||
"prompt": "score_6, score_5, score_4, score_3, score_2, score_1, score_0, censored, monochrome, 3d, signature, watermark, username, speech bubble, embedding:zPDXLxxx"
|
||||
"prompt": "score_4, score_3, score_2, score_1, score_0, censored, monochrome, 3d, signature, watermark, username, speech bubble, embedding:zPDXLxxx"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+20
-14
@@ -2,24 +2,30 @@ import os
|
||||
import json
|
||||
|
||||
class PromptSelectNode:
|
||||
# Determine the base directory path without the src subdirectory
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
if os.sep + "src" in dir_path:
|
||||
dir_path = dir_path.replace(os.sep + "src", "")
|
||||
positive_prompts = {}
|
||||
negative_prompts = {}
|
||||
|
||||
# Define the path to the JSON file containing prompts
|
||||
json_path = os.path.join(dir_path, 'prompts.json')
|
||||
|
||||
# Load prompts from the JSON file
|
||||
with open(json_path, 'r') as file:
|
||||
prompts = json.load(file)
|
||||
|
||||
# Separate positive and negative prompts into dictionaries
|
||||
positive_prompts = {item['name']: item['prompt'] for item in prompts[0]['positive']}
|
||||
negative_prompts = {item['name']: item['prompt'] for item in prompts[0]['negative']}
|
||||
@classmethod
|
||||
def load_prompts(cls):
|
||||
# Determine the base directory path without the src subdirectory
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
if os.sep + "src" in dir_path:
|
||||
dir_path = dir_path.replace(os.sep + "src", "")
|
||||
|
||||
# Define the path to the JSON file containing prompts
|
||||
json_path = os.path.join(dir_path, 'prompts.json')
|
||||
|
||||
# Load prompts from the JSON file
|
||||
with open(json_path, 'r') as file:
|
||||
prompts = json.load(file)
|
||||
|
||||
# Separate positive and negative prompts into dictionaries
|
||||
cls.positive_prompts = {item['name']: item['prompt'] for item in prompts[0]['positive']}
|
||||
cls.negative_prompts = {item['name']: item['prompt'] for item in prompts[0]['negative']}
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
cls.load_prompts()
|
||||
# Generate input types dynamically from the loaded prompts
|
||||
positive_prompt_names = ['None'] + list(cls.positive_prompts.keys())
|
||||
negative_prompt_names = ['None'] + list(cls.negative_prompts.keys())
|
||||
|
||||
Reference in New Issue
Block a user