Shiny-filteRs - Shiny Contest Submission

Shiny-filteRs

Authors: Matthew Oldach

Abstract: :camera:Shiny-filteRs :camera_flash: is an Instagram-“like” application designed with shinyMobile, leveraging 12 Python :snake: and R libraries for "filters" which are not only aesthetically pleasing but are based on mathematical formulae (e.g. Voronoi diagram).

Full Description:

CLICK HERE TO GO TO MY SHINY APPLICATION DEPLOYMENT!!!

Inspiration for the Shiny Application {Shiny-filteRs}

“There’s something romantic in preservation at a moment of static bliss.” - Marina Keegan

When I take on a side-project it's important that I have fun and learn something. It's an added bonus if I can create something that others find useful and enjoyable to use. This year's shiny contest entry was no exception!

My first Shiny application allowed users with no programming background to generate maps of the islands of Hawaii.

For my second application, I also wanted to create something that could be shown to someone with no idea of what R (or even Python or Javascript) was but immediately understand its underlying potential. You know, something that my family could look at and say, "Don't they have a couple of applications like this already?"

This would be my first-time entry to RStudio's Shiny Contest 2021.

Just like the previous two years, apps for this year's contest are judged on:

  • technical merit
  • artistic achievement (e.g. UI design)

To meet these criteria, I leveraged multiple languages (i.e. R, Python and Javascript) in order to develop a R-Shiny mobile application which would allow users to create something artistic.

For this, I leveraged {shinyMobile}, {shinysense} (a shiny-module powered by Javascript enabling Shiny to interact with cameras), and a variety of artistic Python and R libraries to create 12 "filters".

This here, is a story about agile development, a story about shinyMobile, and most importantly, it's a story about aRt :iphone::art:

{shinyMobile}

{shinyMobile} is built on top of the latest Framework7, enabling it to behave like a native mobile app. It can have an icon on your phones home screen, open in full screen mode, show a splash screen when opening, and other tidbits that mobile users expect. For an instagram-like application it only made sense to design something for the mobile.

Although the application is still in an early stage of development the application I deployed to shinyapps.io works great on my Samsung 8. Most of the issues that I filled were responded to quickly and overall I was very happy with the project :blush:

For this project, I needed to file the following issues for {shinyMobile}:

The last issue was something I was wanting to add as my own artistic idea for a filter. The idea was to jokingly illuminate how willing most users are to give away information when they click "Accept" on those very-long terms of use (which no one reads) just for the chance to use some cool social application!

It would have been added were it not for some missing features in the {magick} R wrapper. It seems that some of the underlying capabilities of the C++ ImageMagick package have no R mapping yet). A further limitation is that, currently, it is not possible to install other software and libraries on shinyapps.io so I needed to file an issue to add this (it has not been added yet).

To give the back-story, I had wanted to include another filter which used both Colin Fay's {geoloc} package in conjunction with {qrcode} in order to generate a QR code of a users IP address, adjust its transparency to 50% then overlay it over a selected image. When a user would click the Download my image! button they would get both their selected filter as well as this additional freebie overlay filter which could be scanned with a QR code reader to reveal their IP address. Therefore, although conceptualized, this concept was never fully realized...

{shinysense}

The {shinysense} package is a nice demonstration of how R can leverage the power of Javascript to detect and take pictures from a phone (with both the front and rear camera).

I was hoping to give users an option of using dark-mode (because that's what all the cool-kids are using these days...)

But... unfortunately, the issue I raised on {shinysense} back in February was never answered. Furthermore, I don't know anything about javascript so I was unable to trouble-shoot this on my own.

Furthermore, the shinysense::run_demo() function didn't work for me initially. I did experience some issues getting the package working as I was met with a previously reported issued Error: div.st until I followed a very convoluted installation process using {renv}. Warning: it's my opinion that this project is no longer under active development

filteRs

I wanted to be cheeky and include the capital R in filteRs because, I'm a huge fanboy, and it's really the R-Shiny engine at the heart which makes this whole project possible. Furthermore, there a number of cool R packages for

However, I also wanted to include the following Python filters in the project as well:

For unknown, reasons, the same method used to install the necessary Python packages for this application (glitchart, pixelate, Pillow, and tqdm) did not work for pastiche a PyTorch implementation of Neural Style Transfer. Sadly then, I couldn't include this filter for which I'd spent a considerable time optimizing the descent looking style-image which could create the most aesthetically pleasing output with the fewest --num-steps (most images require too much training time, which would bore the average user).

Agile Development

Ultimately, I try to use the right-tool for the right job. Over-engineering is a no-no - shipping is key. Deploy, get feedback, and provide new releases as required. - that's the normal cycle. Could I have built a production-grade Shiny-application using {golem}?

Probably, but it might be overkill for this purpose (a demonstration of my and R-Shiny capabilities, not a production app). First get a minimum viable product up and running. If bugs are uncovered by users they can be dealt with then. Could I have killed myself over getting a few more "filters" added? Most certainly, but I think what I delivered provides a nice starting-point for future development.

Thank you for taking the time to read about my entry for the RStudio Shiny Contest (2021).

If you missed it at the top, you can CLICK HERE TO GO TO MY SHINY APPLICATION DEPLOYMENT!!!

Note: Remember to allow the camera!


Keywords: aRt, mobile, language-agnostic, fun
Shiny app: https://https://matthew-j-oldach.shinyapps.io/shiny-filteRs/
Repo: GitHub - moldach/shiny-filteRs: 📷 shiny-filteRs 📸 is an R-Shiny (& Python 🐍) Instagram-"like" application
RStudio Cloud: Posit Cloud

Thumbnail:
image

Full image: