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
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/segmind-vega-rt-v1"
# Request payload
data = {
"prompt": "backlight, wilderness woman hunting in jungle hiding behind leaves, face paintings closeup face portrait, detailed eyes, nature documentary, dry skin, fuzzy skin, lens flare",
"num_inference_steps": 4,
"seed": 758143278,
"img_width": 1024,
"img_height": 1024,
"base64": False
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Prompt to render
Number of denoising steps.
min : 4,
max : 10
Seed for image generation.
min : -1,
max : 999999999999999
Can only be 1024 for SDXL
Allowed values:
Can only be 1024 for SDXL
Allowed values:
Base64 encoding of the output image.
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.
Segmind-VegaRT a distilled consistency adapter for Segmind-Vega that allows to reduce the number of inference steps to only between 2 - 8 steps.
Latent Consistency Model (LCM) LoRA was proposed in LCM-LoRA: A universal Stable-Diffusion Acceleration Module by Simian Luo, Yiqin Tan, Suraj Patil, Daniel Gu et al.
This model is the first base model showing real-time capabilities at higher image resolutions, but has its own limitations;
The model is good at close up portrait images of humans but tends to do poorly on full body images.
Full body images may show deformed limbs and faces.
This model is an LCM-LoRA model, so negative prompt and guidance scale parameters would not be applicable.
Since it is a small model, the variability is low and hence may be best used for specific use cases when fine-tuned.
We will be releasing more fine tuned versions of this model so improve upon these specified limitations.