summaryrefslogtreecommitdiffstats
path: root/g4f/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/client.py')
-rw-r--r--g4f/client.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/g4f/client.py b/g4f/client.py
index 117db375..03b0eda3 100644
--- a/g4f/client.py
+++ b/g4f/client.py
@@ -241,7 +241,8 @@ class Images():
"",
[{"role": "user", "content": prompt}],
True,
- proxy=self.client.get_proxy()
+ proxy=self.client.get_proxy(),
+ **kwargs
)
else:
response = provider.create(prompt)
@@ -253,15 +254,20 @@ class Images():
def create_variation(self, image: ImageType, model: str = None, **kwargs):
provider = self.models.get(model) if model else self.provider
- if isinstance(provider, BaseProvider):
+ result = None
+ if isinstance(provider, type) and issubclass(provider, BaseProvider):
response = provider.create_completion(
"",
[{"role": "user", "content": "create a image like this"}],
True,
image=image,
- proxy=self.client.get_proxy()
+ proxy=self.client.get_proxy(),
+ **kwargs
)
for chunk in response:
if isinstance(chunk, ImageProviderResponse):
- return ImagesResponse([Image(image)for image in list(chunk.images)])
- raise NoImageResponseError() \ No newline at end of file
+ result = ([chunk.images] if isinstance(chunk.images, str) else chunk.images)
+ result = ImagesResponse([Image(image)for image in result])
+ if result is None:
+ raise NoImageResponseError()
+ return result \ No newline at end of file