AI Background Remover

फ्रीमियम
द्वारा Firdavs Shodiyev | अपडेट किया गया 2달 전 | Artificial Intelligence/Machine Learning
लोकप्रियता

9.3 / 10

लेटेंसी

2,864ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

What data is returning this API

Rapid account: Upardhi
upardhi
vor 25 Tagen

Background removal is occurring, the API is returning the image without its background.

I aim to store the background-removed image elsewhere, such as on a CDN server, but I’m encountering difficulty due to the unspecified content type or lack of documentation regarding the API. Could you please assist me with this?

Rapid account: Upardhi
upardhi Commented vor 24 Tagen

@firdavscoder1 : i am getting the response of image but when I am trying to save it in my local directory or on cloudeflare its throwing the error or invalid image . I am not sure what is reponse I am getting

Need Help

const removeBackgroundOfImage = async (req) => {
const { path } = req.body;
const removeBackgroundSettings = await db.RemoveBackgroundSettings.findOne({
where: {
isActive: true,
},
});

if (!removeBackgroundSettings) {
throw new Error(“RemoveBackgroundSettings not found”);
}
if (!path) {
throw new Error(“Path not found”);
}
const imageStream = await getStreamFromURL(path);
const formData = new FormData();
formData.append(“file”, imageStream); // Append the image path directly
const options = {
method: “POST”,
url: removeBackgroundSettings.url,

data: formData,

};
options.headers = {
[removeBackgroundSettings.headerKey]: removeBackgroundSettings.headerValue,
[removeBackgroundSettings.headerHostKey]:
removeBackgroundSettings.headerHostValue,
…formData.getHeaders(),
responseType: “stream”, // To handle the binary response properly
};
const response = await axios.request(options);

//Create image and upload on cloudeflare and return the path
const folderName = “temp”; // Replace “your_folder” with your desired folder name
const directory = path.join(process.cwd(), folderName);
const filePath = path.join(directory, filename);

try {
fs.writeFile(filename, content, “binary”, (err) => {
if (err) {
console.error(“Error saving the file:”, err);
return;
}
console.log(“File saved successfully!”);
});
return filePath;
} catch (err) {
throw new Error(Error saving the file: ${err.message});
return res;
};

Rapid account: Firdavscoder 1
firdavscoder1 Commented vor 25 Tagen

Hi.

Can you specifiy the error with a screenshot, please ? I guess it is solved by some coding. You can save the result as an image on your local and send it to the server. If you want, you can write to my email firdavscoder1@gmail.com

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें