Code Monkey home page Code Monkey logo

venice_directions_nanogenmo's Introduction

venice_directions_nanogenmo

V2, improved version of my nanogenmo 2019 entry, "Directions in Venice."

This project uses data from OpenStreetMap for places in Venice, Tracery grammar to generate static directions and prompts for the GPT-2 model, a GPT-2 model trained on open source Venice history books and purchased guidebooks. The model uses recent context plus atmosphere priming for the output. There are random images pulled from flickr pics of Venice (hopefully :) and segments of a tourist map of Venice, on which scribbled annotations have been randomly added.

The improvements since Nanogenmo came from a longer training time on the model, for slightly better output grammar and sense; plus some improved output cleaning and prompt code. Also added attribution links to the flickr images and scary hand-drawn annotations on the map excerpts. There are still some grammar and punctuation fixes needed, but far fewer than the first attempt.

Background Story

When I was in Venice in mid-November, my AirBnB host tried to give me directions to some places he liked using a paper map. Every time he circled a square and paused, I thought, "This is where it is," and it wasn't. The directions kept going on and on and were really complicated because Venice is complicated (or was, without mobile GPS). I wanted to recreate the experience of listening to him.

He also interspersed historical and suggested detours in his directions, which is the bulk of the experience here. Plus some details from what I saw in Venice in the frame story.

Some Tech Details

This project used Tracery grammars (pytracery from Allison Parrish), downloaded data on canals and roads from Open Street Map (wow that was non-obvious), plus a small GPT-2 model I ran locally, trained on historic and recent guidebooks/ histories of Venice (Gutenberg books plus a couple I purchased).

The GPT-2 model was tuned using Max Woolf's colab and served locally using his gpt-2-cloud-run directions. (Note: It uses tensorflow 1, not 2, and you need to make sure you install the right version for your platform.)

The "mood" of the generated text is supposed to change over the course of the story, using a progress percentage calculator to determine certain prompt texts to feed to the model. The end sections are darker, colder, and creepier, theoretically! Venice at night is sometimes quite gothic. However, not all generated text uses the mood alteration, and so it's not consistent in tone alteration.

The Images

To spruce the output up, I added little random excerpts from a tourist map of Venice, on which I added crazy annotations. Also, I mixed in some random Flickr photos of Venice, to really set the mood better. The images are now links, back to their source. It may be that not all the images are actually Venice, depending on how the random selection with keywords went. Btw, I went with Flickr over Unsplash because Unsplash was way too perfect-looking. These Flickr pics are pretty damn fine in any case.

The slightly improved code is in the V2 Jupyter notebook.

Result

You can read the latest raw version here.

venice_directions_nanogenmo's People

Contributors

arnicas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.