mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
feat(docs/client.md): add base64 response format for image generation
This commit is contained in:
parent
61e74deb0f
commit
72e8152853
1 changed files with 18 additions and 1 deletions
|
|
@ -154,7 +154,7 @@ from g4f.client import Client
|
|||
client = Client()
|
||||
|
||||
response = client.images.generate(
|
||||
model="dall-e-3",
|
||||
model="flux",
|
||||
prompt="a white siamese cat"
|
||||
# Add any other necessary parameters
|
||||
)
|
||||
|
|
@ -164,6 +164,23 @@ image_url = response.data[0].url
|
|||
print(f"Generated image URL: {image_url}")
|
||||
```
|
||||
|
||||
|
||||
#### Base64 Response Format
|
||||
```python
|
||||
from g4f.client import Client
|
||||
|
||||
client = Client()
|
||||
|
||||
response = client.images.generate(
|
||||
model="flux",
|
||||
prompt="a white siamese cat",
|
||||
response_format="b64_json"
|
||||
)
|
||||
|
||||
base64_text = response.data[0].b64_json
|
||||
print(base64_text)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Creating Image Variations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue