If you're looking for an API, you can choose from your desired programming language.
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
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/furniture-staging"
# Request payload
data = {
"prompt": "photo of a white table with plant pot placed on an interior",
"main_image": image_url_to_base64("https://i.ibb.co/z8pdz41/main-image.png"), # Or use image_file_to_base64("IMAGE_PATH")
"overlay_image": image_url_to_base64("https://i.ibb.co/bHhQFBq/overlay-image.png"), # Or use image_file_to_base64("IMAGE_PATH")
"main_image_mask": image_url_to_base64("https://i.ibb.co/GFxb3SX/main-image-mask.png"), # Or use image_file_to_base64("IMAGE_PATH")
"overlay_image_mask": image_url_to_base64("https://i.ibb.co/8cqzRHL/overlay-image-mask.png"), # Or use image_file_to_base64("IMAGE_PATH")
"steps": 25,
"seed": 42424242,
"guidance": 30,
"image_format": "png",
"image_quality": 95
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
The main prompt describing the scene or subject
The URL of the main image
The URL of the overlay image
The URL of the main image mask
The URL of the overlay image mask
The number of steps for image processing
min : 10,
max : 100
Random seed for reproducibility
Guidance scale for adjusting adherence to the prompt
min : 1,
max : 50
The output image format
Allowed values:
The quality of the output image
min : 10,
max : 100
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.
Each parameter of the model controls a specific aspect of the furniture staging process. Here's a breakdown:
prompt:
This describes the scene or subject you want to stage. Write a detailed description of how the staged furniture or design should look.
main_image:
The primary image of the room or space where the furniture will be staged. Ensure the URL is accessible and points to a clear, high-quality image.
overlay_image:
The secondary image containing the furniture or staging items to overlay on the main image. Provide the URL of the furniture/staging image.
main_image_mask:
A mask for the main image. This defines areas to focus on for staging (e.g., walls, floors). If not provided, staging might be applied globally.
overlay_image_mask (optional):
steps:
This determines the number of processing steps. Higher values lead to better quality but take longer.
seed:
Sets a random seed for reproducibility. Change this if you want different variations of the same setup.
guidance:
Controls how strictly the output adheres to the prompt. Higher values ensure the output matches your prompt but can reduce creativity.
image_format:
Specifies the format of the output image. Options are usually png
, jpeg
, etc. Choose png
for lossless quality.
image_quality:
Sets the quality of the output image. Higher values produce better quality but larger file sizes.
Prepare Your Inputs
Make sure all inputs are ready:
Images:
main_image
and overlay_image
to a cloud service or use an accessible URL.Prompt:
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training
CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training