Cloud-connected talking photobooth using TensorFlow
This project contains all the code required to build a cloud-connected, talking photobooth powered by Android Things. This is the codebase that was used in the Photobooth demo at Google I/O 2017. It will take your photo, style it with Tensorflow, upload it to the cloud, and print the photo out. Upon request, it can also share your photo to its twitter account.
This demo uses the following Google platforms and APIs:
Note: The Android Things Console will be turned down for non-commercial use on January 5, 2022. For more details, see the FAQ page.
One Android-Things powered device with a connected camera. This demo ran on a Raspberry Pi 3, but is in no way limited to that device.
One Google Assistant device. It's a talking photobooth, so you need something to handle the VUI. You can use a Google Home, or build your own.
(Optional)
(Optional)
Most of the steps here are best described by existing documentation, which is better to link to than to paraphrase. In order, do the following.
Import this project in Android Studio
Add Firebase to your Android project
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if true;
allow write: if request.auth != null;
}
}
}
Deploy the Google Cloud Functions which are located in project-root/firebase
These interact with multiple services you will also need to set up:
/**
* Twitter Info
*/
var TWTR_CONSUMER_KEY = functions.config().twitter.consumer_key;
var TWTR_CONSUMER_SECRET = functions.config().twitter.consumer_secret;
var TWTR_ACCESS_TOKEN_KEY = functions.config().twitter.access_token_key;
var TWTR_ACCESS_TOKEN_SECRET = functions.config().twitter.access_token_secret;
/**
* API key for the Google URL shortener API
* https://developers.google.com/url-shortener/v1/getting_started#APIKey
*/
var URL_SHORTENER_API_KEY = functions.config().shorturl.key;
Code for the Google Assistant app (the voice UI) is in the agent/ directory. To deploy it, follow the Getting Started Guide for Actions On Google.
Printing strategies will vary - For the photobooth demo we set up CUPS on a second Raspberry Pi and attached it to a Photobooth printer (the setup of CUPS and various printer models is wildly beyond the scope of this document). It's also possible (and likely easier) to get a printer that supports Google Cloud Print, and use the sendJobs API call to activate a print job over the internet.
If you've found an error in this sample, please file an issue: https://github.com/androidthings/photobooth/issues
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.
This Android Things app is currently configured to launch only when deployed from your
development machine. To enable the main activity to launch automatically on boot,
add the following intent-filter
to the app's manifest file:
<activity ...>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Copyright 2017 Google, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.