summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/create_images.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-13 15:37:36 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-13 15:37:36 +0100
commitea8d6b847a0e656cc5583948c5745592adda7103 (patch)
treecb796ff258d339a5ee4a4ec3fb4b2617e6639677 /g4f/Provider/create_images.py
parentChange pypi to live (diff)
downloadgpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.tar
gpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.tar.gz
gpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.tar.bz2
gpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.tar.lz
gpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.tar.xz
gpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.tar.zst
gpt4free-ea8d6b847a0e656cc5583948c5745592adda7103.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)