Fixed some Markdown formatting and moved the Buzz README to the correct location.
This commit is contained in:
parent
589d3e8ccb
commit
8068cd1900
|
@ -1,4 +1,4 @@
|
|||
# Buzz Ruby Sample #
|
||||
# Buzz Ruby Sample
|
||||
This is a simple starter project written in Ruby which provides a minimal
|
||||
example of Buzz integration within a Sinatra web application.
|
||||
|
||||
|
@ -6,7 +6,7 @@ Once you've run the starter project and played with the features it provides,
|
|||
this starter project provides a great place to start your experimentation into
|
||||
the API.
|
||||
|
||||
## Prerequisites ##
|
||||
## Prerequisites
|
||||
Please make sure that all of these are installed before you try to run the
|
||||
sample.
|
||||
|
||||
|
@ -20,7 +20,7 @@ sample.
|
|||
-- dm-sqlite-adapter
|
||||
-- google-api-ruby-client
|
||||
|
||||
## Setup Authentication ##
|
||||
## Setup Authentication
|
||||
|
||||
This API uses OAuth 2.0. Learn more about Google APIs and OAuth 2.0 here:
|
||||
http://code.google.com/apis/accounts/docs/OAuth2.html
|
||||
|
@ -32,19 +32,19 @@ Or, if you'd like to dive right in, follow these steps.
|
|||
- Click the button labeled "Create an OAuth2 client ID"
|
||||
- Give your application a name and click "Next"
|
||||
- Select "Web Application" as the "Application type"
|
||||
- Under "Your Site or Hostname" select http:// as the protocol and enter
|
||||
- Under "Your Site or Hostname" select "http://" as the protocol and enter
|
||||
"localhost" for the domain name
|
||||
- click "Create client ID"
|
||||
|
||||
Edit the buzz.rb file and enter the values for the following properties that
|
||||
you retrieved from the API Console:
|
||||
|
||||
- oauth_client_id
|
||||
- oauth_client_secret
|
||||
- `oauth_client_id`
|
||||
- `oauth_client_secret`
|
||||
|
||||
Or, include them in the command line as the first two arguments.
|
||||
|
||||
## Running the Sample ##
|
||||
## Running the Sample
|
||||
|
||||
I'm assuming you've checked out the code and are reading this from a local
|
||||
directory. If not check out the code to a local directory.
|
||||
|
@ -53,6 +53,6 @@ directory. If not check out the code to a local directory.
|
|||
|
||||
$ ruby buzz.rb
|
||||
|
||||
2. Open your web browser and see your activities! Go to http://localhost:4567/
|
||||
2. Open your web browser and see your activities! Go to `http://localhost:4567/`
|
||||
|
||||
3. Be inspired and start hacking an amazing new web app!
|
|
@ -15,7 +15,8 @@ formatted data into Google Storage.
|
|||
1 - You must first create the bucket you want to use. This can be done
|
||||
with the gsutil function or via the web UI (Storage Access) in the Google
|
||||
APIs Console. i.e.
|
||||
`$ gsutil mb gs://BUCKET`
|
||||
|
||||
$ gsutil mb gs://BUCKET
|
||||
|
||||
OR
|
||||
|
||||
|
@ -25,12 +26,13 @@ and create your bucket there.
|
|||
2 - We now load the data you want to use to Google Storage. We have supplied a
|
||||
basic language identification dataset in the sample for testing.
|
||||
|
||||
`$ chmod 744 setup.sh`
|
||||
`$ ./setup.sh BUCKET/OBJECT`
|
||||
$ chmod 744 setup.sh
|
||||
$ ./setup.sh BUCKET/OBJECT
|
||||
Note you need gsutil in your path for this to work.
|
||||
|
||||
If you have your own dataset, you can do this manually as well.
|
||||
`$ gsutil cp your_dataset.csv gs://BUCKET/your_dataset.csv`
|
||||
|
||||
$ gsutil cp your_dataset.csv gs://BUCKET/your_dataset.csv
|
||||
|
||||
|
||||
In the script, you must then modify the datafile string. This must correspond with the
|
||||
|
@ -51,8 +53,8 @@ API. You can also set it up so the user can grant access.
|
|||
|
||||
First, run the google-api script to generate access and refresh tokens. Ex.
|
||||
|
||||
`$ cd google-api-ruby-client`
|
||||
`$ ruby bin/google-api oauth-2-login --scope=https://www.googleapis.com/auth/prediction --client-id=NUMBER.apps.googleusercontent.com --client-secret=CLIENT_SECRET`
|
||||
$ cd google-api-ruby-client
|
||||
$ ruby bin/google-api oauth-2-login --scope=https://www.googleapis.com/auth/prediction --client-id=NUMBER.apps.googleusercontent.com --client-secret=CLIENT_SECRET
|
||||
|
||||
Fill in your client-id and client-secret from the API Access page. You will
|
||||
probably have to set a redirect URI in your client ID
|
||||
|
@ -81,7 +83,8 @@ At this, point, you should have
|
|||
loading the generated .yaml file
|
||||
|
||||
We can now run the service!
|
||||
`$ ruby prediction.rb`
|
||||
|
||||
$ ruby prediction.rb
|
||||
|
||||
This should start a service on `http://localhost:4567`. When you hit the service,
|
||||
your ruby logs should show the Prediction API calls, and print the prediction
|
||||
|
@ -91,4 +94,3 @@ This sample currently does not cover some newer features of Prediction API such
|
|||
as streaming training, hosted models or class weights. If there are any
|
||||
questions or suggestions to improve the script please email us at
|
||||
prediction-api-discuss@googlegroups.com.
|
||||
|
||||
|
|
Loading…
Reference in New Issue