In order to self-host, it's easiest to use Google Cloud Platform. Create a GCP project if do not have one already for your projct. The following instructions assume you have your GCP Project ID handy.
The bucket contains 191.63 GB of doodles. Assuming multiregional storage, and at the time of writing this, your cost would be ($0.026 * 191.63) = $4.98 per month. Storage and transferring between GCS buckets may vary based on your bucket location (it's free to transfer in the same region, bucket to bucket). You can find more details here.
- In your GCP Project, go to Storage > Browser and create a bucket with a unique id of your choosing (leave all other default settings)
- Go to Storage > Transfer
- Select "Google Cloud Storage bucket" as the source, and enter
gs://quickdraw-data-completeand the Cloud Storage bucket source. Press continue. - Enter
gs://YOUR_BUCKET_IDwhereYOUR_BUCKET_IDis the unique id you chose in the first step. Leave all other default settings and press continue. - Leave the default transfer settings to run now, and press "Create". The files will now transfer over.
-
Run
npm installin this directory -
In the root of this API directory, create a
config.jsonfile replacing the values below (GCS_BUCKET_IDis the bucket you created when copying the data over in the above step) :{ "projectId": "YOUR_PROJECT_ID", "bucketId": "GCS_BUCKET_ID" }
NOTE: If you secure your bucket to certain roles, you can add your service account credential key in this config file by adding: "keyFilename": "./PATH_TO_SERVICE_ACCOUNT_KEY"
You can now run npm start and the server should run locally on your machine at http://localhost:8080. You can then try sending a request using the instructions below.
Choose your local or production server:
# If you're running locally, you won't need an API key.
$ export ENDPOINTS_HOST=http://localhost:8080
$ export ENDPOINTS_HOST=https://YOUR_PROJECT_ID.appspot.com
$ export ENDPOINTS_KEY=AIza...
Send the request:
$ curl -vv -H 'Content-Type: application/json' "${ENDPOINTS_HOST}/drawing/cat/count?key=${ENDPOINTS_KEY}"
If you're running locally, you won't need an API key.
-
You will need to make sure you have Python 2.7.x installed as well as the Google Cloud SDK on your local machine.
-
Change
__app.yamltoapp.yamland inside the file, updatename: YOUR_PROJECT_ID.appspot.comreplacingYOUR_PROJECT_IDwith the ID of the project you created in GCP where the files live. -
Change
__openapi-appengine.yamltoopenapi-appengine.yamland inside the file, updatehost: "YOUR_PROJECT_ID.appspot.com"replacingYOUR_PROJECT_IDwith the same project ID. -
Run
npm run deploy-specto deploy your API definition file -
Run
npm run deployto deploy your application code
The component & API fall under the Apache 2.0 license.
This data is made available by Google, Inc. under the Creative Commons Attribution 4.0 International license.