GithubHelp home page GithubHelp logo

jlooper / ombromanie Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 46.15 MB

๐Ÿคš Storytelling with Hand Shadows

Home Page: https://brave-river-00627910f.1.azurestaticapps.net/

JavaScript 0.51% HTML 0.26% Vue 4.83% CSS 94.32% SCSS 0.09%

ombromanie's Introduction

๐Ÿคš ๐Ÿค™ ๐Ÿ‘‹ Ombromanie: Create a Hand Shadow Show using Machine Learning ๐Ÿ‘‹ ๐Ÿค™ ๐Ÿคš

Telling stories by casting hand shadows is an ancient Asian art form, popularized in the 18th century in Europe. The effect can be achieved simply by turning out all lights and using one candle and one person making shadows in front of a screen or wall. It's a fun way to entertain yourself and the kids by creating stories on a wall with just your hands.

Try the app live!

Hand shadows on the wall

What if, however, you're clean out of candles and it's the middle of the day and you're bored working from home? Time to reproduce the experience of an Ombromanie show...but using a web app!

Architecture

In this demo, we use TensorFlow.js's HandPose library, which unfortunately right now only allows you to use one hand to project poses to the screen. However you can tell a story using this web app, record it, and save it as a local file to send to someone as a gift.

The shadow casting is handled by leveraging the Canvas API in the browser, copying the keypoints of the moving hand and using an offset shadow to show a fuzzy black image mimicking a shadow to a white background, like a wall.

The web app is done in Vue.js with an Azure Function handling delivery of a key, needed by Microsoft Cognitive Services Speech-To-Text Service.

Project setup to run locally

CD to your project's /app folder and type:

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Lints and fixes files

npm run lint

To run the function locally, CD to the /api folder and in its root, add a local.settings.json file. In that file, paste the following code:

{
	"IsEncrypted": false,
	"Values": {
		"AzureWebJobsStorage": "",
		"FUNCTIONS_WORKER_RUNTIME": "node",
		"VUE_APP_SPEECH_KEY": "add-a-key-here"
	}
}

Obtain a Speech-To-Text key by subscribing to the service.

This code shows the implementation in Show.vue:

async startAudioTranscription() {
      try {
        //get the key
        const response = await axios.get("/api/getKey");
        this.subKey = response.data;
        //sdk

        let speechConfig = sdk.SpeechConfig.fromSubscription(
          this.subKey,
          "eastus"
        );
        let audioConfig = sdk.AudioConfig.fromDefaultMicrophoneInput();
        this.recognizer = new sdk.SpeechRecognizer(speechConfig, audioConfig);

        this.recognizer.recognized = (s, e) => {
          this.text = e.result.text;
          this.story.push(this.text);
        };

        this.recognizer.startContinuousRecognitionAsync();
      } catch (error) {
        this.message = error;
      }
    },

Create your shadow-stories, click record, and save them plus your speech text in the app. You can then scrape to an email or other sharing format.

Hosting

This web app is hosted on Azure as an Azure Static Web App. Host your own using this button:

Deploy to Azure button

Learn more about Azure Static Web Apps by building one!

Learn more

Blogpost

Slides, presented at WebStories Conf, Lille.

Video Conference Talk about Ombromanie

ombromanie's People

Contributors

dependabot[bot] avatar jlooper avatar msftgits avatar

Stargazers

 avatar  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.