summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-09 08:51:49 +0100
committerGitHub <noreply@github.com>2024-02-09 08:51:49 +0100
commit1d6709dafc27f7ce64df235b20ad47e2d3486ab0 (patch)
tree59e40d1130f97d219aacc9de37f4d3f6f2bc3274 /README.md
parentMerge pull request #1564 from hlohaus/gemini (diff)
parentFix Phind Provider / add generate_challenge (diff)
downloadgpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.tar
gpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.tar.gz
gpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.tar.bz2
gpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.tar.lz
gpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.tar.xz
gpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.tar.zst
gpt4free-1d6709dafc27f7ce64df235b20ad47e2d3486ab0.zip
Diffstat (limited to '')
-rw-r--r--README.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/README.md b/README.md
index 91826b9a..797ce304 100644
--- a/README.md
+++ b/README.md
@@ -358,6 +358,21 @@ response = g4f.ChatCompletion.create(
# Displaying the response
print(response)
+
+from g4f.image import ImageResponse
+
+# Get image links from response
+for chunk in g4f.ChatCompletion.create(
+ model=g4f.models.default, # Using the default model
+ provider=g4f.Provider.OpenaiChat, # Specifying the provider as OpenaiChat
+ messages=[{"role": "user", "content": "Create images with dogs"}],
+ access_token="...", # Need a access token from a plus user
+ stream=True,
+ ignore_stream=True
+):
+ if isinstance(chunk, ImageResponse):
+ print(chunk.images) # Print generated image links
+ print(chunk.alt) # Print used prompt for image generation
```
##### Using Browser