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-complete
and the Cloud Storage bucket source. Press continue. - Enter
gs://YOUR_BUCKET_ID
whereYOUR_BUCKET_ID
is 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 install
in this directory -
In the root of this API directory, create a
config.json
file replacing the values below (GCS_BUCKET_ID
is 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.yaml
toapp.yaml
and inside the file, updatename: YOUR_PROJECT_ID.appspot.com
replacingYOUR_PROJECT_ID
with the ID of the project you created in GCP where the files live. -
Change
__openapi-appengine.yaml
toopenapi-appengine.yaml
and inside the file, updatehost: "YOUR_PROJECT_ID.appspot.com"
replacingYOUR_PROJECT_ID
with the same project ID. -
Run
npm run deploy-spec
to deploy your API definition file -
Run
npm run deploy
to 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.