From 3b10acc73247ec703ed47f0423e7d255a91f074e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 16 Dec 2018 00:11:20 +0100 Subject: tabulator --- megapixels/app/site/s3.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'megapixels/app/site/s3.py') diff --git a/megapixels/app/site/s3.py b/megapixels/app/site/s3.py index 99726a4d..5464d464 100644 --- a/megapixels/app/site/s3.py +++ b/megapixels/app/site/s3.py @@ -3,6 +3,9 @@ import glob import boto3 def sync_directory(base_fn, s3_path, metadata): + """ + Synchronize a local assets folder with S3 + """ fns = {} for fn in glob.glob(os.path.join(base_fn, 'assets/*')): fns[os.path.basename(fn)] = True -- cgit v1.2.3-70-g09d2 From 6ce4a4589f8e21b038f1ff636da60e9881651a4a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 16 Dec 2018 12:28:45 +0100 Subject: build -i to build a single page --- megapixels/app/site/builder.py | 10 ++++++++++ megapixels/app/site/parser.py | 5 +++-- megapixels/app/site/s3.py | 9 ++++++--- megapixels/commands/site/build.py | 14 ++++++++++---- site/public/about/credits/index.html | 2 +- site/public/about/index.html | 2 +- site/public/research/00_introduction/index.html | 12 ++++++------ site/public/research/index.html | 2 +- 8 files changed, 38 insertions(+), 18 deletions(-) (limited to 'megapixels/app/site/s3.py') diff --git a/megapixels/app/site/builder.py b/megapixels/app/site/builder.py index 895f265b..ff1a0c83 100644 --- a/megapixels/app/site/builder.py +++ b/megapixels/app/site/builder.py @@ -18,6 +18,8 @@ def build_page(fn, research_posts): """ build a single page from markdown into the appropriate template - writes it to site/public/ + - syncs any assets with s3 + - handles certain index pages... """ metadata, sections = parser.read_metadata(fn) @@ -91,3 +93,11 @@ def build_site(): for fn in glob.iglob(os.path.join(cfg.DIR_SITE_CONTENT, "**/*.md"), recursive=True): build_page(fn, research_posts) build_research_index(research_posts) + +def build_file(fn): + """ + build just one page from a filename! =^) + """ + research_posts = parser.read_research_post_index() + fn = os.path.join(cfg.DIR_SITE_CONTENT, fn) + build_page(fn, research_posts) diff --git a/megapixels/app/site/parser.py b/megapixels/app/site/parser.py index 6c6ad688..ca6ac77b 100644 --- a/megapixels/app/site/parser.py +++ b/megapixels/app/site/parser.py @@ -55,8 +55,8 @@ def format_metadata(section): return "
{}
".format(''.join(meta)) def format_applet(section, s3_path): - print(section) - payload = section.strip('```').strip().split('\n') + # print(section) + payload = section.strip('```').strip().strip('```').strip().split('\n') applet = {} print(payload) if ': ' in payload[0]: @@ -213,6 +213,7 @@ def parse_metadata(fn, sections): metadata['sync'] = metadata['sync'] != 'false' metadata['author_html'] = '
'.join(metadata['authors'].split(',')) + return metadata, valid_sections def read_research_post_index(): diff --git a/megapixels/app/site/s3.py b/megapixels/app/site/s3.py index 5464d464..18133078 100644 --- a/megapixels/app/site/s3.py +++ b/megapixels/app/site/s3.py @@ -6,13 +6,14 @@ def sync_directory(base_fn, s3_path, metadata): """ Synchronize a local assets folder with S3 """ + if not metadata['sync']: + return + fns = {} for fn in glob.glob(os.path.join(base_fn, 'assets/*')): + # print(fn) fns[os.path.basename(fn)] = True - if not metadata['sync']: - return - remote_path = s3_path + metadata['url'] session = boto3.session.Session() @@ -31,6 +32,7 @@ def sync_directory(base_fn, s3_path, metadata): if 'Contents' in directory: for obj in directory['Contents']: s3_fn = obj['Key'] + # print(s3_fn) fn = os.path.basename(s3_fn) local_fn = os.path.join(base_fn, 'assets', fn) if fn in fns: @@ -52,6 +54,7 @@ def sync_directory(base_fn, s3_path, metadata): for fn in fns: local_fn = os.path.join(base_fn, 'assets', fn) s3_fn = os.path.join(remote_path, 'assets', fn) + print(s3_fn) print("s3 create {}".format(s3_fn)) s3_client.upload_file( local_fn, diff --git a/megapixels/commands/site/build.py b/megapixels/commands/site/build.py index 0a76a9ac..2d344899 100644 --- a/megapixels/commands/site/build.py +++ b/megapixels/commands/site/build.py @@ -4,12 +4,18 @@ Build the static site import click -from app.site.builder import build_site +from app.site.builder import build_site, build_file @click.command() +@click.option('-i', '--input', 'input_file', required=False, + help='File to generate') @click.pass_context -def cli(ctx): +def cli(ctx, input_file): """Build the static site """ - print('Building the site...') - build_site() + if input_file: + print('Building {}'.format(input_file)) + build_file(input_file) + else: + print('Building the site...') + build_site() diff --git a/site/public/about/credits/index.html b/site/public/about/credits/index.html index 67e9dcb8..b1b394bd 100644 --- a/site/public/about/credits/index.html +++ b/site/public/about/credits/index.html @@ -28,7 +28,7 @@

Credits

-
alt text
alt text
    +
    • MegaPixels by Adam Harvey
    • Made with support from Mozilla
    • Site developed by Jules Laplace
    • diff --git a/site/public/about/index.html b/site/public/about/index.html index 67e9dcb8..b1b394bd 100644 --- a/site/public/about/index.html +++ b/site/public/about/index.html @@ -28,7 +28,7 @@

      Credits

      -
      alt text
      alt text
        +
        • MegaPixels by Adam Harvey
        • Made with support from Mozilla
        • Site developed by Jules Laplace
        • diff --git a/site/public/research/00_introduction/index.html b/site/public/research/00_introduction/index.html index 290208f8..4349bcaf 100644 --- a/site/public/research/00_introduction/index.html +++ b/site/public/research/00_introduction/index.html @@ -3,8 +3,8 @@ MegaPixels - - + + @@ -28,21 +28,21 @@
          -

          Untitled Page

          +

          00: Introduction

          Posted
          -
          2018-12-31
          +
          2018-12-15
          By
          -
          Adam Harvey
          +
          Megapixels
          -

          It was the early 2000s. Face recognition was new and no one seemed sure exactly how well it was going to perform in practice. In theory, face recognition was poised to be a game changer, a force multiplier, a strategic military advantage, a way to make cities safer and to secure borders. This was the future John Ashcroft demanded with the Total Information Awareness act of the 2003 and that spooks had dreamed of for decades. It was a future that academics at Carnegie Mellon Universtiy and Colorado State University would help build. It was also a future that celebrities would play a significant role in building. And to the surprise of ordinary Internet users like myself and perhaps you, it was a future that millions of Internet users would unwittingly play role in creating.

          +
          Posted
          Dec. 15
          Author
          Adam Harvey

          It was the early 2000s. Face recognition was new and no one seemed sure exactly how well it was going to perform in practice. In theory, face recognition was poised to be a game changer, a force multiplier, a strategic military advantage, a way to make cities safer and to secure borders. This was the future John Ashcroft demanded with the Total Information Awareness act of the 2003 and that spooks had dreamed of for decades. It was a future that academics at Carnegie Mellon Universtiy and Colorado State University would help build. It was also a future that celebrities would play a significant role in building. And to the surprise of ordinary Internet users like myself and perhaps you, it was a future that millions of Internet users would unwittingly play role in creating.

          Now the future has arrived and it doesn't make sense. Facial recognition works yet it doesn't actually work. Facial recognition is cheap and accessible but also expensive and out of control. Facial recognition research has achieved headline grabbing superhuman accuracies over 99.9% yet facial recognition is also dangerously inaccurate. During a trial installation at Sudkreuz station in Berlin in 2018, 20% of the matches were wrong, a number so low that it should not have any connection to law enforcement or justice. And in London, the Metropolitan police had been using facial recognition software that mistakenly identified an alarming 98% of people as criminals 1, which perhaps is a crime itself.

          MegaPixels is an online art project that explores the history of facial recognition from the perspective of datasets. To paraphrase the artist Trevor Paglen, whoever controls the dataset controls the meaning. MegaPixels aims to unravel the meanings behind the data and expose the darker corners of the biometric industry that have contributed to its growth. MegaPixels does not start with a conclusion, a moralistic slant, or a

          Whether or not to build facial recognition was a question that can no longer be asked. As an outspoken critic of face recognition I've developed, and hopefully furthered, my understanding during the last 10 years I've spent working with computer vision. Though I initially disagreed, I've come to see technocratic perspective as a non-negotiable reality. As Oren (nytimes article) wrote in NYT Op-Ed "the horse is out of the barn" and the only thing we can do collectively or individually is to steer towards the least worse outcome. Computational communication has entered a new era and it's both exciting and frightening to explore the potentials and opportunities. In 1997 getting access to 1 teraFLOPS of computational power would have cost you $55 million and required a strategic partnership with the Department of Defense. At the time of writing, anyone can rent 1 teraFLOPS on a cloud GPU marketplace for less than $1/day. 2.

          diff --git a/site/public/research/index.html b/site/public/research/index.html index 17b4a2a0..1acbe844 100644 --- a/site/public/research/index.html +++ b/site/public/research/index.html @@ -29,7 +29,7 @@

          Research Blog

          The darkside of datasets and the future of computer vision

          -
          +