1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/flux-ipadapter"
# Request payload
data = {
"adapter_strength": 1,
"base64": False,
"guidance_scale": 3.5,
"image": "https://segmind-sd-models.s3.amazonaws.com/display_images/assets_statue.jpeg",
"image_format": "jpeg",
"num_inference_steps": 20,
"prompt": "wearing sunglasses with red hair",
"quality": 95,
"samples": 1,
"seed": 32556,
"strength": 1,
"True_gs": 2
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Strength of the adapter effect
min : 0,
max : 1
Output as base64 encoded string
Guidance scale for the generation
min : 1,
max : 10
URL of the input image
Output image format
Allowed values:
Description of what to avoid in the image
Number of inference steps
min : 10,
max : 75
Description of the image to be generated
Image quality setting for output
min : 10,
max : 100
Number of samples to generate
min : 1,
max : 4
Random seed for generation
Strength of the effect applied
min : 0,
max : 2
True guidance scale value
min : 1,
max : 10
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Flux IP Adapter by XLabs AI is a groundbreaking model that revolutionizes image generation by seamlessly integrating style adaptation into pre-trained text-to-image diffusion models. This innovative tool empowers users to create high-quality, visually stunning images tailored to specific styles or concepts.
The Flux IP Adapter enables precise control over image style, allowing users to effortlessly transition between different artistic styles. The Flux IP Adapter has undergone rigorous training, ensuring exceptional performance and accuracy in generating high-quality images. Trained on both 512x512 and 1024x1024 resolutions, the model offers flexibility for various image generation tasks, from detailed close-ups to panoramic views
Creative Expression: Artists and designers can leverage the Flux IP Adapter to explore new creative horizons and generate unique, visually captivating images.
Marketing and Branding: Businesses can use the model to create visually appealing content that aligns with their brand identity and resonates with their target audience.