From 4f901fbf8d05bd1f120a30eac709cf9edcf37ebe Mon Sep 17 00:00:00 2001 From: Dag Thomas Olsen Date: Fri, 20 Dec 2024 23:53:48 +0100 Subject: [PATCH] added own json for gemini model if someone needs to test out experimental stuff without a release. --- data/gemini_models.json | 12 ++++++++++++ sdxl_utility.py | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 data/gemini_models.json diff --git a/data/gemini_models.json b/data/gemini_models.json new file mode 100644 index 0000000..af0aba9 --- /dev/null +++ b/data/gemini_models.json @@ -0,0 +1,12 @@ +{ + "models": [ + "gemini-1.5-pro-latest", + "gemini-2.0-flash-thinking-exp-1219", + "gemini-2.0-flash-exp", + "gemini-exp-1206", + "gemini-2.0-flash-exp", + "gemini-exp-1206", + "gemini-1.5-pro-exp-0801", + "gemini-1.5-flash" + ] +} diff --git a/sdxl_utility.py b/sdxl_utility.py index 1f5777e..1b3c088 100644 --- a/sdxl_utility.py +++ b/sdxl_utility.py @@ -25,7 +25,11 @@ from transformers import AutoProcessor def tensor2pil(t_image: torch.Tensor) -> Image: return Image.fromarray(np.clip(255.0 * t_image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8)) +models_file = os.path.join(os.path.dirname(__file__), "data", "gemini_models.json") +with open(models_file, 'r') as f: + models_data = json.load(f) + gemini_models = models_data.get('models', []) # Function to load data from a JSON file def load_json_file(file_name): # Construct the absolute path to the data file @@ -635,6 +639,7 @@ class GeminiTextOnly: @classmethod def INPUT_TYPES(s): + return { "required": { "custom_prompt": ("STRING", {"multiline": True, "default": ""}), @@ -644,7 +649,7 @@ class GeminiTextOnly: "sex": ("STRING", {"default": "male"}), "words": ("STRING", {"default": "100"}), "pronouns": ("STRING", {"default": "him, his"}), - "gemini_model": (["gemini-1.5-pro-latest", "gemini-2.0-flash-exp", "gemini-exp-1206", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash"],), + "gemini_model": (gemini_models,), } } @@ -1045,7 +1050,7 @@ class GeminiCustomVision: "FLOAT", {"default": 15.0, "min": 0.1, "max": 50.0, "step": 0.1}, ), - "gemini_model": (["gemini-1.5-pro-latest", "gemini-2.0-flash-exp", "gemini-exp-1206", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash"],), + "gemini_model": (gemini_models,), } }