ARImageSynthesizer

פרמיום
על ידי ArdicAITeam | מְעוּדכָּן a month ago | Artificial Intelligence/Machine Learning
פּוֹפּוּלָרִיוּת

9 / 10

חֶבִיוֹן

214ms

רמת שירות

100%

Health Check

N/A

חזרה לכל הדיונים

GET does not return image, it returns JSON

Rapid account: Franalissar
franalissar
6 months ago

Basically when I do a request with postman I get the desired image in the body of th response, but when I do the request on a javascript file I get another json with this:

{2 items
"hash":"<my-image-hash>"
“message”:“File already in progress.”
}

What am I doing wrong here?

This is my getImage code:
const getPicture = async (hashval) => {
const url =
https://arimagesynthesizer.p.rapidapi.com/get?hash=’+hashval+’&returnType=image’;
const options = {
method: “GET”,
headers: {
“X-RapidAPI-Key”: “api-key”,
“X-RapidAPI-Host”: “arimagesynthesizer.p.rapidapi.com”,
},
};

try {
await fetch(url, options)
.then((response) => response.blob())
.then((blob) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = () => {
const base64data = reader.result;
console.log(base64data);
const parentElement = document.getElementById(“imageDiv”);
const imgElement = document.createElement(‘img’);
imgElement.id = ‘genimg’;
imgElement.src = base64data;
parentElement.append(imgElement);
};
});
} catch (error) {
console.error(error);
}
};

export default getPicture();

Rapid account: Ardic AI Team
ArdicAITeam Commented 6 months ago

Hello Franalissar,

The JSON response you received is not an error; it is simply meant to inform you about the image generation process. By default, all requests are placed in a queue, and the images are generated in accordance with their position in the queue. In your case, your request is currently at the front of the queue and is being processed.

At the moment, we are facing some technical difficulties due to high traffic, which may cause your image to be stuck in the “in process” state or even discarded. Rest assured, our team is actively working on finding a solution and implementing a better way to keep users informed.

Best regards,
ARDIC AI Team

הצטרף לדיון - הוסף תגובה למטה:

התחבר / הירשם כדי לפרסם תגובות חדשות