How I Build Machine Learning Apps in Hours

Original article was published by Arunn Thevapalan on Artificial Intelligence on Medium

Wrapping ML models into apps in hours is no more a big deal. If you know Python, trust me, you know Streamlit. If you know Streamlit, trust me, you can do it too.

I’m going to tell you precisely how I did and walk you through a real-world example. Stay with me till the end, and you’ll be amazed how much you’ll learn in such a short time. Let’s roll!

Why Build ML Apps

The awesome machine learning project (say) you and I just built on Jupyter Notebooks, nobody is going to use it. Sure, if we accompany a good README file in our GitHub repository and write a blog post on it, people would check it out, but still, nobody is going to use it. It’s sad, but also reality.


Unless you and I convince them to use it by lowering the barriers as much as possible. Demos, documentation, tutorials, you name it but nothing is as effective as letting the users check out a machine learning web app by themselves, interact with the application, feed input, and be amazed by the output. That’s the real win.

I didn’t just discover it overnight. I learned it with experience. A little about me here would serve the purpose, I am a Machine Learning Engineer in an AI startup, and my daily work mostly revolves around researching, prototyping, and delivering machine learning solutions for various business problems. You might think that’s the hard part, no, machine learning is my art, and I enjoy acing it. The hardest part is to convince. First, convincing the internal decision-makers that this solution would work and second, convincing (potential) clients. The struggle is real, my friend.

Communication is one of the most important skills for any role in the data science world. After trying numerous techniques around presentations, simulations, and more, in terms of effectiveness, one thing stood out. The Machine Learning (Web) App.

I believe it has something to do with letting the decision-maker see the “magic” themselves.

Streamlit to the rescue

For most projects I’ve worked on, I often spend sufficient time researching, building, and optimizing my machine learning solution, not to mention the time it takes to pre-process and clean the data. Naturally, in the end, there’s no time left to build a presentation worthy demo or anything of that sort. So when I had less than a day left to demo one of the recent projects (not allowed to disclose much about the project yet!) I worked on, I ended up checking out my luck with Flask, Dash, and so on until I stumbled upon Streamlit.

I had only a few hours to figure out Streamlit, so I didn’t have a choice but to type these two commands on my terminal.

pip install streamlit
streamlit hello

And this is what I saw.

Screencast of Streamlit Hello by the Author

I was truly amazed and I had hope. I knew I could build the app before my deadline (Spoiler: I built it in no time!). I wish I could show you exactly what I ended up building with Streamlit, but since I probably am not allowed to, I’ve decided to build a similar model for a real-world use-case of diabetes prediction and quickly wrap it into a Streamlit web app.