summaryrefslogtreecommitdiffstats
path: root/g4f/client/image_models.py
diff options
context:
space:
mode:
authorkqlio67 <kqlio67@users.noreply.github.com>2024-09-06 00:34:12 +0200
committerkqlio67 <kqlio67@users.noreply.github.com>2024-09-06 00:34:12 +0200
commit24d4ea055af77d312806b8cbad606ab4889227bb (patch)
treef64ade5b24ec525de4270a6f15f7494da56f0717 /g4f/client/image_models.py
parentfeat(images): add async support and logging, enhance image handling (diff)
downloadgpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.tar
gpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.tar.gz
gpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.tar.bz2
gpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.tar.lz
gpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.tar.xz
gpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.tar.zst
gpt4free-24d4ea055af77d312806b8cbad606ab4889227bb.zip
Diffstat (limited to 'g4f/client/image_models.py')
-rw-r--r--g4f/client/image_models.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/g4f/client/image_models.py b/g4f/client/image_models.py
index db2ce09a..edaa4592 100644
--- a/g4f/client/image_models.py
+++ b/g4f/client/image_models.py
@@ -2,18 +2,15 @@ from __future__ import annotations
from .types import Client, ImageProvider
-from ..Provider.BingCreateImages import BingCreateImages
-from ..Provider.needs_auth import Gemini, OpenaiChat
-from ..Provider.You import You
+from ..models import ModelUtils
class ImageModels():
- gemini = Gemini
- openai = OpenaiChat
- you = You
-
- def __init__(self, client: Client) -> None:
+ def __init__(self, client):
self.client = client
- self.default = BingCreateImages(proxy=self.client.get_proxy())
+ self.models = ModelUtils.convert
- def get(self, name: str, default: ImageProvider = None) -> ImageProvider:
- return getattr(self, name) if hasattr(self, name) else default or self.default
+ def get(self, name, default=None):
+ model = self.models.get(name)
+ if model and model.best_provider:
+ return model.best_provider
+ return default