Creating an interactive web GUI for arbitrary Python programs


#1

I’ve used R Shiny and Python Dash in the past a bit. I’ve recently been tasked with building a web app, and I am trying to figure out if Python Dash can handle this use case. I need to build an app that can:

  • upload a user’s image

  • run a custom Python machine learning program on the image

  • display a visualization of the machine learning output next to the source image (some kind of interactive heatmap)

  • allow the user to zoom in & out and interactively select areas of the heatmap or original image to view details on

When I used Dash in the past, I had difficultly running arbitrary external programs with it; I am not sure what the situation for this currently is. Would Dash be appropriate for this? Or would I need a more low-level framework to do this, and if so, any suggestions? Thanks.


#2

Dash can definitely do all of those things. The only things that’s a little unclear is

running arbitrary external programs with it
What do you mean by this? Nearly any data manipulation you can do in python is dash-friendly as that is sort of the intent.

also see: Show and Tell - Dash Image Processing App with Pillow, S3 and Redis


#3

For running arbitrary programs, the question is less can Dash support it, but more can Python support it. To which the answer is very likely yes. If there’s not an API for the program you want, you can use the subprocess module to run arbitrary commands, if the program is installed on the same machine. if the program is on a different machine, you’ll need to use some kind of message passing library like celery.


#4

Thanks for the replies. My intention (at the time of posting) was to use Dash as a general-purpose web framework. I have found that Django is actually much better for that. Maybe things have changed for Dash in the past year since I originally posted this, but lack of support for more general web app development outside the scope of data manipulation was a huge hindrance for me using Dash, especially as a beginner coming from a data-science background and little understanding of web dev.