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 years contest are judged on:

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 📱🎨

{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 😊

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). I’ve created a transition video using of Hadley Wickham to show you what the input/output of the filter would have looked like:

Agile Development

Ultimately, I try to use the right-tool for the right job. Over-engineering is a no-no - shipping is key. 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!