newsdev/who-the-hill

Name: who-the-hill

Owner: NYT Newsroom Developers

Description: Who The Hill: An MMS-based facial recognition service for members of Congress.

Created: 2017-08-11 17:50:01.0

Updated: 2018-05-22 23:00:48.0

Pushed: 2018-05-11 19:32:17.0

Homepage: null

Size: 121

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Who The Hill

What is Who The Hill?

Shazam, but for House members faces.

Who The Hill is an MMS-based facial recognition service for members of Congress. Reporters covering Congress can text pictures of members of Congress to a number we?ve set up and they?ll get back:

  1. A list of all the members of Congress recognized in their picture
  2. Numbers indicating how confident Amazon is about the recognition
  3. Colors corresponding to each member of Congress recognized
  4. The picture they sent, but with a box around each member of Congress in the color corresponding to them

Who The Hill in the flesh

Local Installation

Before getting the app running, you'll need a Twilio account (with an operational MMS number), an Amazon Rekognition account and an Amazon S3 or Google Cloud Storage account.

Who The Hill also requires Python3 and works best with virtualenv and virtualenvwrapper. For more on how NYT Interactive News sets up our Python environment, check out this blog post by Sara Simon.

clone https://github.com/newsdev/who-the-hill.git && cd who-the-hill
rtualenv whothehill
install -r requirements.txt

To run the app locally, you will need some environment variables.

Three sets of AWS (or AWS-like) keys are needed:

(You can find more information about the AWS and AWS-like credentials here.)

You will also need credentials and a number from Twilio.:

IO_ACCOUNT_SID
IO_AUTH_TOKEN
IO_NUMBER

To check whether results returned from Rekognition are actually members of Congress, you can either use the json dump of members of Congress (as well as variations on spellings of their name) included in this repo, or use your own API endpoint that returns similarly formatted json. If you don't set this environment variable, Who The Hill will default to using the included json file:

NAMES_ENDPOINT

You can store your environment variables in a dev.env file…

rt AWS_ACCESS_KEY_ID='<YOUR_ID>'
rt AWS_SECRET_ACCESS_KEY='<YOUR_ACCESS_KEY>'
rt AWS_DEFAULT_REGION='<YOUR_PREFERRED_REGION>'
rt TWILIO_ACCOUNT_SID='<YOUR_ACCOUNT_SID>'
rt TWILIO_AUTH_TOKEN='<YOUR_AUTH_TOKEN>'

…and run source dev.env. This will export your credentials to your environment.

Running the App

You can run the app locally as a web service that integrates with Twilio or as a CLI for examining a folder full of images to recognize.

As a web application

Run the app locally python who_the_hill/web/pub.py and tunnel with ngrok so that you can integrate with Twilio, which needs a public-facing endpoint to POST data to.

As a CLI for recognition

Put the images within which you'd like to recognize members of Congress into a folder like /tmp/to_recognize and then call the CLI like this:

on who_the_hill/cli --directory /tmp/to_recognize/

The app will examine the images, find and recognize faces, and produce a JSON report. Note: The CLI still requires working S3/GCS tokens and (obviously) access to the AWS Rekognition API. It does not require Twilio credentials, though.

Acknowledgements

Jennifer Steinhauer came up with the original idea behind Who The Hill and was an enthusiastic sponsor and tester.

Who The Hill was developed by Interactive News interns Gautam Hathi and Sherman Hewitt in the summer of 2017 and partially rewritten in the spring of 2018 by Jeremy Bowers, all under the watchful eye of Rachel Shorey.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.