Logic Labyrinth
AI Generated image by Dall-E 3
AI Generated image by Dall-E 3

Building a Python web app

Written by Dan Hubbert

One of the problems with trying to stay on top of developments in AI is that the ‘native’ language of machine learning is Python, so most of the good tutorials and examples of the newest techniques and technologies tend to be written in Python.

For business applications and other commercial applications in the cloud, the ‘native’ language would be more likely to be Javascript. That’s a little simplistic, the reality is a lot more complicated depending on whether you’re discussing server side, client side or mobile etc. but it’s a reasonable generalization.

So while you’re experimenting with new things, you’re often working in a Python notebook, but as you move towards a more production-ready application you move into Javascript/Typescript and whatever tech stack you favor for your front and back end.

This is reflected in the fact that frameworks like Langchain and Superagent have both Python and Javascript versions.

Sometimes I have a neat demo of some kind I’ve got working in Python, but I want to demo it to people in the business somewhere either internally or with clients. Unfortunately, scraps of Python code in a Jupyter Notebook aren’t the best way to do that.

Tools like Superagent and Streamlit can help with this, providing easy quick ways to present Python code in a more user-friendly way. I wanted something to add to that which was fast and easy to work with but also under my control.

The solution I settled on after a bit of research was to build a Flask app and give it a nice front end so it would present well to internal business users and clients. I wanted to keep it simple and fast to develop so I decided to use HTMX, Alpine.js and Tailwind CSS to build the front end.

The result is logical labyrinth lab. It’s a little light on content at the moment but I’ll be adding to it over time.