WELCOME TO EHOST.COM.NP

Sunday, April 30, 2017

How to get Google Assistant on your Windows, Mac, or Linux Machine

ads space

Google Assistant is Google’s answer to Amazon’s Alexa smart home assistant. Initially only available with limited functionality in the Google Allo application, Google Assistant later rolled out with the Google Home and Pixel smartphones to bring the full power of Google’s assistant to consumers.

After a few months of waiting, smartphones running Android 6.0+ also received Google Assistant, and just a few days ago Google launched the Google Assistant SDK which allows Assistant to be run on basically any platform. Today, we will show you how to install Google Assistant onto your Windows, Mac, or Linux machine using Python.

Note: at this point in time, this is purely for educational purposes. There’s no fancy GUI for you to play with, and installing Assistant requires you to use the command line.


Get Google Assistant on Windows/Mac/Linux Machines

Requirements:

You’ll need to have Python installed no matter whether or not you are using Windows, macOS, or a GNU/Linux distribution. Installation is fairly simple and already well-documented by the Python wiki, so we won’t go into many details about getting Python up and running on your machine.

Once you’ve got Python working on your machine (you can confirm it is working by opening up a terminal/command prompt and then simply typing python.) If you see the terminal/command prompt return the current Python version on your computer, then you’re golden.

Next, before we can install the necessary files to get Google Assistant working, we need to enable access to the Google Assistant API in the Google Cloud Platform Console.


Configure the Google Assistant API

What follows are step-by-step instructions walking you through the process to enable the Google Assistant API in the Cloud Platform Console so you can access Google Assistant through the Python program. All of these steps are platform independent, meaning that the steps are the same for Windows, macOS, and GNU/Linux users.

  1. Go to the Projects page in the Google Cloud Platform Console.
  2. Click on “Create Project” up top.
  3. Name the Project “My Google Assistant” and click “Create.”
  4. Wait a few seconds for the Console to create your new Project. You should see a spinning progress icon in the top right. After it is done creating your Project, you will be brought to your Project’s configuration page.
  5. Click this link to go straight to the Google Assistant API page. Up top, click “Enable.”
  6. Google will warn you that you need to create credentials to use this API. Click “Create credentials” in the top right. This will take you to a setup wizard page where Google helps you figure out what kind of credentials you need to use this API.
  7. Under “where will you be calling the API from”, select “Other UI (e.g. Windows, CLI tool)“. For “what data will you be accessing” select the “User data” circle. Now tap “what credentials do I need?”
  8. Google should recommend that you create an OAuth 2.0 client ID. Name the Client ID anything you want, for example, your name + Desktop. Once done picking a name, click “create client ID.”
  9. Under “product name shown to users” enter “My Google Assistant.” Click continue.
  10. Click “done.” There’s no need to click download here as we only need the client secret, which we will download next.
  11. Now under the list of OAuth 2.0 client IDs, you should see the client ID you just made. All the way to the right, click on the download icon to download the client_secret_XXX.json file, where ‘XXX’ is your client ID. Save this file anywhere on your computer, ideally in a new folder called “googleassistant.”
  12. Go to the Activity controls page for your Google account and make sure that “Web & App Activity”, “Location History”, “Device Information”, and “Voice & Audio Activity” are enabled. This is so Google Assistant can actually read you personalized information.

We have now created a mechanism for a client, in this case our Windows/Mac/Linux machine, to access the Google Assistant API under our Google account. Next we need to set up the client that will access the Google Assistant API.

Install the Google Assistant Sample Python Project

Although Google recommends that you set up Python virtual environments to isolate the Google Assistant SDK and its dependencies from other Python system packages, we’re going to skip this step as it’s unlikely that you’ll play around with this for more than a few minutes. You can easily go back to the Cloud Platform Console and disable the API if you’re worried about the potential for other programs to access your Google account.

Open up a terminal/command prompt window and go through the following steps. First, enter this command:


py -m pip install google-assistant-sdk[samples]

You should see a whole bunch of dependencies being downloaded and installed when you enter this command. These are needed for the sample Python project to work. Wait for it to finish.

Once it’s done, next enter the following command (make sure to adjust the path):


py -m googlesamples.assistant.auth_helpers --client-secrets path\to\your\client_secret_XXX.apps.googleusercontent.com.json

In the command prompt, you will see a response telling you to visit a URL in order to authorize the application.

Copy and paste this URL into your browser. Select the same Google account that you used to configure the Google Assistant API. On the next page, you will see a text box that contains your client’s Access Token.

Copy that Access token and paste it into the command prompt where it asks you for the authorization code. If done correctly, you will see a response that your credentials have been saved.


Test the Google Assistant

The first thing you’ll want to test is whether or not Google Assistant is able to record audio from your microphone. Enter the following command into a command prompt, which will record 5 seconds of audio and play it back to you:


python -m googlesamples.assistant.audio_helpers

If you hear your audio played back to you, then enter this command to begin talking to Google Assistant:


python -m googlesamples.assistant

Wait for the command prompt to say “press Enter to send a new request”, then press Enter to begin talking to Google Assistant. After you’re done speaking, the command prompt will display a transcript of what you just stated and then play back the response. If you see a warning afterwards, just ignore it.

Have fun playing with Google Assistant on your Windows, macOS, or GNU/Linux machine! I played with it for only a few minutes before getting bored with it. It’s not particularly useful in this format, but it is a very quick demonstration of the possibilities that the new Google Assistant SDK represents. Perhaps we may see desktop apps or browser extensions taking advantage of this functionality in the near future.

ads space
ADS SPACE

0 comments:

Post a Comment

Categories

Article How-to All Posts WordPress Android Web design Blogger Plugins CSS Google JQuery Plugins Programming Reviews Web Hosting Blogger Blogging Blogging Tips Tricks Web Development Facebook Git Internet Make Money Online Social Plugins Tips Tips and Tricks Tools Tutorials Windows WordPress Plugins Blogging Tips and Tricks Freebies GSM Google Analytics HTML How To's JavaScript Plugin Development S.E.O SEO SMS SmartPhone Social Media Tips amp; Tricks Top-Most Updates Webmaster Tools Whatsapp Applications Apps Blogger Basics Documentary Downloads Entertainment Gadgets Games Gmail Google AdSense Guest Post IPhone Make Money Blogging SVN Security Softwares Web Hosting Tips and Tricks Wordpress Tips Wordpress Tips and Tricks hostgator iOS Advertising Networks Advertising Technology Affiliates Antivirus Audience amp; Traffic Biography Blog post Blog post Blogger Blogger Errors Blogger Tips Blogger Tools Blogger Widget Blogosphere Bogger Widgets CSS selectors CSS symbols CSS3 Computer amp; Internet Content Writing Coupon Codes Data amp; Analytics Deleted blog Design DoubleClick for Publishers Email and newsletter marketting Email marketing Excel Tips Excel Tips and Tricks Facebook Tricks Feed Feedburner Feedburner subscribers Font Fun GitHub Giveaways Gmail primary inbox Gmail tabs Google sign-in Guides HTML amp; CSS HTML5 Infographics Inspirational Instagram Internet Marketing Internet Tips amp; Tricks Job Listings Knowledge Life Hacks Lists Make-Money Monetization amp; Conversion Monetize Navigation Online Marketing Other PHP Tutorials Passport Publishing amp; Content Quotes RSS Sidebar Smartphones Social Networking Status Tech Tech Blog Technology Telegram Themes UI / UX User Psychology amp; Research VB.Net Web Tools Web browser Widget Windows Tips Windows-10 ad viewability admin notice blogging tools bluehost cherry-pick clone cors custom scrollbar customizer dismissible notices duplicate post feed title git branch git clone gpg gpg2 hybridauth iPad icon font notice responsive wordpress theme same origin policy scrollbar signed git commit smartsvn theme customizer vcs wordpress theme wordpress themes

Blog Archive