ARImageSynthesizer

GRATIS CON POSSIBILITร€ DI UPGRADE
Da ArdicAITeam | Aggiornamento il y a 2 mois | Artificial Intelligence/Machine Learning
Popolaritร 

9.1 / 10

Latenza

135ms

Livello di servizio

100%

Health Check

N/A

Torna a tutte le discussioni

For anyone wondering how to actually get an image from this...

Rapid account: Branchleannelmb
branchleannelmb
il y a un an

We were banging our heads against the keyboard trying to figure out how to get an image from this API at first (students here just learning CS), but finally landed upon an output with this code below. Feel free to use to make your life easier ๐Ÿ˜„ Note that the below is in Javascript (we are using express and handlebars).

For the URL replace the hash with a hash of your own. For the API, put in your API key.

const getPicture = async () => {
const url =
โ€˜https://arimagesynthesizer.p.rapidapi.com/get?hash=40ee4f2a4f7d6b6e37ffa4a728812de3&returnType=imageโ€™;
const options = {
method: โ€˜GETโ€™,
headers: {
โ€˜X-RapidAPI-Keyโ€™: โ€˜API key goes hereโ€™,
โ€˜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); //GETS US A USEABLE BASE64 OUTPUT

      //img element creation
      const parentElement = document.getElementById('testtext');
      const imgElement = document.createElement('img');
      imgElement.id = 'genimg';
      imgElement.src = base64data;
      parentElement.append(imgElement);
    };
  });
// const result = await response.text();
// console.log(result);

} catch (error) {
console.error(error);
}
};

getPicture();

Rapid account: Quotelink 545
quotelink545 Commented il y a un an

i second this we suffered >.>

Partecipa alla discussione - aggiungi un commento di seguito:

Accedi/Iscriviti per pubblicare nuovi commenti