From 6e064adb094bacd10bd8bbc8c18a405e1cf651cd Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 22 Apr 2024 18:08:04 +0200 Subject: Add gemini-1.5-pro-latest model --- g4f/gui/server/api.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'g4f/gui/server/api.py') diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 3d9f6a1c..020b2090 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -45,6 +45,7 @@ class Api(): @staticmethod def get_image_models() -> list[dict]: image_models = [] + index = [] for provider in __providers__: if hasattr(provider, "image_models"): if hasattr(provider, "get_models"): @@ -52,14 +53,25 @@ class Api(): parent = provider if hasattr(provider, "parent"): parent = __map__[provider.parent] - for model in provider.image_models: - image_models.append({ - "provider": parent.__name__, - "url": parent.url, - "label": parent.label if hasattr(parent, "label") else None, - "image_model": model, - "vision_model": parent.default_vision_model if hasattr(parent, "default_vision_model") else None - }) + if parent.__name__ not in index: + for model in provider.image_models: + image_models.append({ + "provider": parent.__name__, + "url": parent.url, + "label": parent.label if hasattr(parent, "label") else None, + "image_model": model, + "vision_model": parent.default_vision_model if hasattr(parent, "default_vision_model") else None + }) + index.append(parent.__name__) + elif hasattr(provider, "default_vision_model") and provider.__name__ not in index: + image_models.append({ + "provider": provider.__name__, + "url": provider.url, + "label": provider.label if hasattr(provider, "label") else None, + "image_model": None, + "vision_model": provider.default_vision_model + }) + index.append(provider.__name__) return image_models @staticmethod -- cgit v1.2.3