From 4bc4d635bca9c1c7633ff87ff24b757c653ff60f Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 22 Apr 2024 01:27:48 +0200 Subject: Add vision models to readme --- g4f/gui/server/api.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'g4f/gui/server') diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 435700ea..3d9f6a1c 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -45,16 +45,20 @@ class Api(): @staticmethod def get_image_models() -> list[dict]: image_models = [] - for key, provider in __map__.items(): + for provider in __providers__: if hasattr(provider, "image_models"): if hasattr(provider, "get_models"): provider.get_models() + parent = provider + if hasattr(provider, "parent"): + parent = __map__[provider.parent] for model in provider.image_models: image_models.append({ - "provider": key, - "url": provider.url, - "label": provider.label if hasattr(provider, "label") else None, - "image_model": model + "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 }) return image_models -- cgit v1.2.3