analitics

Pages

Showing posts with label google-cloud-vision. Show all posts
Showing posts with label google-cloud-vision. Show all posts

Monday, May 20, 2019

Python 3.7.3 : The google-cloud-vision python module - part 002.

I used Windows 8.1 and python 3.7.3 version.
The first step is to install the python module.
C:\Python373\Scripts>pip install --upgrade google-cloud-vision
You can see another tutorial about this python module here.
Let's test the python module.
C:\Python373>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD6
4)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import vision
>>> from google.cloud.vision import types
>>> from PIL import Image, ImageDraw
You need to have billing enabled for your Google Cloud Platform project.
Evaluated prices can vary and Google gives us this online calculator, or let us test with a FREE account with 300$.
To change the billing account go to the Google Cloud Platform Console.
Open the console left side menu and select Billing.
If you have more than one billing account then you need to solve this issue, see this webpage.
The Cloud Vision API integrates vision features, like: including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.
You need to set the authentification for your google account and your project, see this page.
The next step is to instantiate a client:
client = vision.ImageAnnotatorClient()
Google provides this tutorial with the same steps as into this tutorial.
You can test and read more about Google Vision on the official page.

Friday, May 5, 2017

The google-cloud-vision python module - part 001.

Google comes with $300 credit for free to sign up into Google Cloud Platform over the next 12 months.
This allows you to deal with access to all Cloud Platform Products.
Today I will show you how to install this platform into your Linux and Windows 10 OS.
For Linux, I used Fedora 26 distro.
Using the Windows 10 operating system and python 2.7 then you can use this command:
pip install --upgrade google-cloud-vision
If you got errors the fix with this command:
C:\Python27\Scripts>pip install --upgrade  --trusted-host  pypi.python.org google-cloud-vision
Collecting google-cloud-vision
  Downloading google_cloud_vision-0.24.0-py2.py3-none-any.whl (68kB)
    100% |################################| 71kB 270kB/s
Collecting google-cloud-core<0 .25dev="">=0.24.0 (from google-cloud-vision)
  Downloading google_cloud_core-0.24.1-py2.py3-none-any.whl (52kB)
    100% |################################| 61kB 1.6MB/s
...
Installing collected packages: appdirs, setuptools, protobuf, httplib2, rsa, pyasn1-modules,
 cachetools, google-auth, google-auth-httplib2, googleapis-common-protos, google-cloud-core,
 pyreadline, dill, futures, grpcio, oauth2client, ply, google-gax, proto-google-cloud-vision-v1,
 gapic-google-cloud-vision-v1, google-cloud-vision, pyparsing
  Found existing installation: appdirs 1.4.0
    Uninstalling appdirs-1.4.0:
      Successfully uninstalled appdirs-1.4.0
  Rolling back uninstall of appdirs
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
...
    with open(path, 'rb') as stream:
IOError: [Errno 2] No such file or directory: 'c:\\python27\\lib\\site-packages\\
appdirs-1.4.0.dist-info\\METADATA'
I run again the command and I don't have errors:
C:\Python27\Scripts>pip install --upgrade  --trusted-host  pypi.python.org google-cloud-vision
Collecting google-cloud-vision
  Downloading google_cloud_vision-0.24.0-py2.py3-none-any.whl (68kB)
    100% |################################| 71kB 597kB/s
Collecting google-cloud-core<0 .25dev="">=0.24.0 (from google-cloud-vision)
...
  Downloading futures-3.1.1-py2-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools->protobuf>=3.0.0->google-cloud-core<0 .25dev="">=0.24.0->google-cloud-vision)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |################################| 61kB 4.7MB/s
Installing collected packages: appdirs, setuptools, protobuf, httplib2, rsa, pyasn1-modules,
 cachetools, google-auth, google-auth-httplib2, googleapis-common-protos, google-cloud-core,
 oauth2client, ply, pyreadline, dill, futures, grpcio, google-gax, proto-google-cloud-vision-v1,
 gapic-google-cloud-vision-v1, google-cloud-vision, pyparsing
  Found existing installation: appdirs 1.4.0
    Uninstalling appdirs-1.4.0:
      Successfully uninstalled appdirs-1.4.0
  Found existing installation: setuptools 34.0.2
    Uninstalling setuptools-34.0.2:
      Successfully uninstalled setuptools-34.0.2
  Found existing installation: httplib2 0.9.2
    Uninstalling httplib2-0.9.2:
      Successfully uninstalled httplib2-0.9.2
  Found existing installation: pyparsing 2.1.10
    Uninstalling pyparsing-2.1.10:
      Successfully uninstalled pyparsing-2.1.10
Successfully installed appdirs-1.4.3 cachetools-2.0.0 dill-0.2.6 futures-3.1.1 
gapic-google-cloud-vision-v1-0.90.3 google-auth-1.0.0 google-auth-httplib2-0.0.2 
google-cloud-core-0.24.1 google-cloud-vision-0.24.0 google-gax-0.15.8 googleapis-common-protos-1.5.2
 grpcio-1.3.0 httplib2-0.10.3 oauth2client-3.0.0 ply-3.8 proto-google-cloud-vision-v1-0.90.3
 protobuf-3.2.0 pyasn1-modules-0.0.8 pyparsing-2.2.0 pyreadline-2.1 rsa-3.4.2 setuptools-35.0.2
For Fedora 26 distro I used this command to install the python module:
[root@localhost mythcat]# pip install --upgrade google-cloud-vision --ignore-installed
WARNING: Running pip install with root privileges is generally not a good idea. 
Try `pip install --user` instead.                                         
Collecting google-cloud-vision
  Using cached google_cloud_vision-0.24.0-py2.py3-none-any.whl
...
 google-auth-httplib2, google-cloud-core, google-cloud-vision
  Running setup.py install for dill ... done
  Running setup.py install for future ... done
  Running setup.py install for googleapis-common-protos ... done
  Running setup.py install for ply ... done
  Running setup.py install for google-gax ... done
  Running setup.py install for httplib2 ... done
  Running setup.py install for oauth2client ... done
  Running setup.py install for proto-google-cloud-vision-v1 ... done
  Running setup.py install for gapic-google-cloud-vision-v1 ... done
Successfully installed appdirs-1.4.3 cachetools-2.0.0 dill-0.2.6 enum34-1.1.6 
future-0.16.0 futures-3.1.1 gapic-google-cloud-vision-v1-0.90.3 google-auth-1.0.0
 google-auth-httplib2-0.0.2 google-cloud-core-0.24.1 google-cloud-vision-0.24.0
 google-gax-0.15.9 googleapis-common-protos-1.5.2 grpcio-1.3.0 httplib2-0.10.3
 oauth2client-3.0.0 packaging-16.8 ply-3.8 proto-google-cloud-vision-v1-0.90.3
 protobuf-3.2.0 pyasn1-0.2.3 pyasn1-modules-0.0.8 pyparsing-2.2.0 rsa-3.4.2 
setuptools-35.0.2 six-1.10.0