url: https://travelnoire.com/best-carnival-celebrations-around-the-world/, pageTitle: Best \u003cb\u003eCarnival\u003c/b\u003e Celebrations Around The World - Travel Noire, fullMatchingImages: [{url: https://travelnoire.com/wp-content/uploads/2019/02/quinten-de-graaf-278848-unsplash.jpg}]
url: https://bespokebrazil.com/rio-carnival-2019/, pageTitle: Visit \u003cb\u003eRio Carnival 2019\u003c/b\u003e with the Brazil Specialists - Bespoke Brazil, partialMatchingImages: [{ url: https://bespoke-brazil-2018-bespokebrazil.netdna-ssl.com/wp-content/uploads/2019/01/Carnival-1.jpg}]
Configurar el Google Cloud proyecto y la autenticación
Si no has creado un Google Cloud proyecto, hazlo ahora. Despliega esta sección para ver las instrucciones.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
Para inicializar gcloud CLI, ejecuta el siguiente comando:
gcloudinit
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
RESULTS_INT: (Opcional) Valor entero de los resultados que se van a devolver. Si omites el campo "maxResults" y su valor, la API devuelve el valor predeterminado de 10 resultados. Este campo no se aplica a los siguientes tipos de funciones: TEXT_DETECTION, DOCUMENT_TEXT_DETECTION o CROP_HINTS.
PROJECT_ID: tu ID de proyecto Google Cloud .
Método HTTP y URL:
POST https://vision.googleapis.com/v1/images:annotate
// detectWeb gets image properties from the Vision API for an image at the given file path.funcdetectWeb(wio.Writer,filestring)error{ctx:=context.Background()client,err:=vision.NewImageAnnotatorClient(ctx)iferr!=nil{returnerr}f,err:=os.Open(file)iferr!=nil{returnerr}deferf.Close()image,err:=vision.NewImageFromReader(f)iferr!=nil{returnerr}web,err:=client.DetectWeb(ctx,image,nil)iferr!=nil{returnerr}fmt.Fprintln(w,"Web properties:")iflen(web.FullMatchingImages)!=0{fmt.Fprintln(w,"\tFull image matches:")for_,full:=rangeweb.FullMatchingImages{fmt.Fprintf(w,"\t\t%s\n",full.Url)}}iflen(web.PagesWithMatchingImages)!=0{fmt.Fprintln(w,"\tPages with this image:")for_,page:=rangeweb.PagesWithMatchingImages{fmt.Fprintf(w,"\t\t%s\n",page.Url)}}iflen(web.WebEntities)!=0{fmt.Fprintln(w,"\tEntities:")fmt.Fprintln(w,"\t\tEntity\t\tScore\tDescription")for_,entity:=rangeweb.WebEntities{fmt.Fprintf(w,"\t\t%-14s\t%-2.4f\t%s\n",entity.EntityId,entity.Score,entity.Description)}}iflen(