Coder Social home page Coder Social logo

ianarawjo / notate-jupyter Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 2.0 194 KB

Tear open drawing canvases inside Jupyter code. In Python, read the canvases as NumPy image data.

License: Other

JavaScript 100.00%
jupyter-notebook-extension jupyter-notebook drawing notation sketch-recognition jupyter notebook-extension

notate-jupyter's Introduction

Notate (Jupyter Notebook Extension)

1. Tear open HTML canvases and draw on them.

Use Ctrl+\ (Backslash) to inject a canvas at the cursor position in the selected cell. Draw on it: A handwritten sum equation.

2. Canvases are auto-passed to Python as 2d NumPy arrays (images) upon run.

In-line, canvases act as variable names. On running the cell, silently injected code sets the variables equal to NumPy image data. (This performs a number of imports: base64, numpy as np, io.BytesIO, and PIL.Image. If you pass the image as a single argument to a function (e.g. foo(canvas)) it will also pass the locals() dict as an added '.locals' attribute of the nparray object.)

3. Do what you want with the output.

Pass handwritten digits to an MNIST recognizer for all I care! Here's an example of a magical QCR function recognizing a handwritten quantum circuit (function not included):

A handwritten quantum circuit magically recognized.

And here's an obligatory MNIST example (see examples/ folder for more):

Passing canvases of numbers 1 2 3 through a Keras recognizer.

Extra features

  • You can copy+paste canvases like you would text.
  • Experimental: You can also paste images and they will be loaded into a canvas. You could, for instance, set a variable equal to an image copied from Google Images.
  • Drag right/bottom sides of canvas to resize.
  • Experimental: When moused over the resize area, click (without moving the cursor) to open a modal dialog and enter width+height pixel values.
  • Click on a canvas to enter full-screen view. It contains a toolbar with basic drawing operations, including undo/redo. Click off the view to minimize:

Fullscreen mode, with a toolbar on the left hand side of the canvas and standard operations like draw rect, circle, line, eraser, undo, redo, and trash.

Install guide

  1. Install Jupyter Notebook Extensions.
  2. Find the nbextensions folder. On Mac, it's in /Users/yourusername/Library/Jupyter.
  3. Place the notate-jupyter folder inside.
  4. If you had Jupyter Notebook open, restart it. On the Jupyter Home page, click the Nbextensions tab. Click 'Notate' to enable.

Required libraries

Relatedly, ensure your namespace doesn't use names Image, BytesIO, or base64 except where imported from the PIL, io, and base64 libraries. Note that I cannot guarantee compatibility with other extensions.

Mileage may vary. Tested on Google Chrome v91.0 with MacOS.

notate-jupyter's People

Contributors

ianarawjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

anjkura woomou

notate-jupyter's Issues

Please add magical QCR function recognizing a handwritten quantum circuit.

Really impressed by your paper. Wanted to try out the the QCR but currently its missing in the repo. A humble request to the authors to add this function. This paper had become a topic of discussion in Quantum Science Days 2023 event. I teach and work in quantum simulation and would love to have this tool in my workflow.

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.