summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/create_images.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-13 15:52:52 +0100
committerGitHub <noreply@github.com>2024-01-13 15:52:52 +0100
commitd632190f1d9ff04759a427d1938c0813e918e5e8 (patch)
tree44e3827128489f13fd6fbe7d18171d81176abc86 /g4f/Provider/create_images.py
parentCleanup unused dependencies (diff)
parentMerge pull request #1462 from hlohaus/img (diff)
downloadgpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.gz
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.bz2
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.lz
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.xz
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.zst
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/create_images.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/g4f/Provider/create_images.py b/g4f/Provider/create_images.py
index 29f88a80..f8a0442d 100644
--- a/g4f/Provider/create_images.py
+++ b/g4f/Provider/create_images.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import re
import asyncio
+from .. import debug
from ..typing import CreateResult, Messages
from ..base_provider import BaseProvider, ProviderType
@@ -26,12 +27,11 @@ class CreateImagesProvider(BaseProvider):
self.create_images = create_images
self.create_images_async = create_async
self.system_message = system_message
+ self.include_placeholder = include_placeholder
self.__name__ = provider.__name__
+ self.url = provider.url
self.working = provider.working
self.supports_stream = provider.supports_stream
- self.include_placeholder = include_placeholder
- if hasattr(provider, "url"):
- self.url = provider.url
def create_completion(
self,
@@ -54,6 +54,8 @@ class CreateImagesProvider(BaseProvider):
yield start
if self.include_placeholder:
yield placeholder
+ if debug.logging:
+ print(f"Create images with prompt: {prompt}")
yield from self.create_images(prompt)
if append:
yield append
@@ -76,6 +78,8 @@ class CreateImagesProvider(BaseProvider):
placeholders = []
for placeholder, prompt in matches:
if placeholder not in placeholders:
+ if debug.logging:
+ print(f"Create images with prompt: {prompt}")
results.append(self.create_images_async(prompt))
placeholders.append(placeholder)
results = await asyncio.gather(*results)