I've been attempting to utilize Clarifai's color API to extract the different colors present in an image. Unfortunately, I am encountering challenges when trying to call the API, as it consistently returns empty objects.
Below is the snippet of code that I've been using to make the API call:
private app;
obj: RootObject;
constructor(private _http: HttpClient) {
this.app = new Clarifai.App({
ApiKey: "CENSOR BAR"
});
};
public getColorValues(imageUrl: string): RootObject {
this.app.models.predict('eeed0b6733a644cea07cf4c60f87ebb7', imageUrl).then(
function (response) {
this.obj = response;
},
function (error) {
this.obj = "There was an error";
}
);
let i: number;
while (this.obj == null) {
i += 1;
}
console.log("Waited " + i + " cycles for response.")
console.log("Object: " + this.obj);
return this.obj;
}