import { Injectable } from '@angular/core' ; import { Http } from '@angular/http' ; import 'rxjs/add/operator/map' ; import { environment } from '../../environment' ; @ Injectable ( ) export class GoogleCloudVisionServiceProvider { constructor ( public http ) { } getLabels ( base64Image ) { const body = { "requests" : [ { "image" : { "content" : base64Image } , "features" : [ { "type" : "LABEL_DETECTION" } ] } ] } ; return this . http . post ( 'https://vision.googleapis.com/v1/images:annotate?key=' + environment . googleCloudVisionAPIKey , body ) ; } }