[PYTHON] Deploy a web app created with Streamlit to Heroku

I've created a web page that makes it easy to process images using Streamlit and Heroku, so I'll leave that introduction.

The app I made

Demo operation

output.gif

Demo page

Source page (Github)

Work log: Create an image processing app with streamlit. :: tomowarkar's tech blog — go 3 steps and go 2 steps

Run locally

pip install streamlit
streamlit run https://github.com/tomowarkar/stapp/blob/master/app.py

What is Streamlit

Streamlit — The fastest way to build custom ML tools

Streamlit's open source app framework is the easiest way for data scientists and machine learning engineers to create beautiful, high-performance apps in hours. Everything in pure Python. It's all free. Streamlit — The fastest way to build custom ML tools (Google Japanese translation)

Goal of this article

--Deploy a web app made with Streamlit on Heroku.

image.png

Premise

-Heroku account and Heroku CLI need to be prepared --The library is managed using pipennv, but of course you can use requirements.txt.

Create workspace, install streamlit

$ mkdir stapp
$ cd stapp
$ pipenv install --python 3
$ pipenv install streamlit

When using requirements.txt

$ mkdir stapp
$ cd stapp
$ pip insatll streamlit
$ echo streamlit==0.60.0 >requirements.txt

App creation

$ touch app.py

app.py


import streamlit as st

st.title("Hello Streamlit!!")

st.subheader("This is calculator.")

a = st.slider("a: ", 0, 10, 5, 1)
b = st.slider("b: ", 0, 10, 5, 1)

st.write(f"{a} x {b} = {a*b}")

That's it

Settings for Heroku [^ 1]

$ echo "web: streamlit run --server.enableCORS false --server.port \$PORT app.py" >Procfile

Git repository initialization

$ git init
$ git add .
$ git commit -m "first commit"

Creating a Heroku app

$ heroku create
$ git push heroku master
$ heroku open

Was the website displayed safely?

Next step

Tutorial: Create a data explorer app — Streamlit 0.61.0 documentation

Streamlit's official tutorial is just right and interesting!

in conclusion

What did you think. You can publish your web app in less than 10 minutes at the earliest.

Although streamlit is not very customizable, you can easily create a web application with a table created with DataFrame of pandas, a graph plotted with matplotlib, and the result of image processing with ʻOpenCV` in just a few lines. You can drop it.

It is very nice that it is completed only with python and you can easily output the deliverables.

Recommended Posts

Deploy a web app created with Streamlit to Heroku
How to deploy a web app made with Flask to Heroku
(Failure) Deploy a web app made with Flask on heroku
Publish a web application for viewing data created with Streamlit on heroku
Deploy a real-time web app with swampdragon x apache
Play like a web app with ipywidgets
Daemonize a Python web app with Supervisor
Create a simple web app with flask
Easy web app with Python + Flask + Heroku
How to deploy a Django app on heroku in just 5 minutes
Deploy a web app created with Streamlit to Heroku
Deploy django project to heroku
How to deploy a Streamlit application to GCP (GAE)
Deploy to Heroku right away without knowing git.
Django Heroku Deploy 1
Detonation velocity python-fire
Django Heroku Deploy 2
Created a new corona app in Kyoto with Python's web framework Dash
How to develop a cart app with Django
How to create a multi-platform app with kivy
I want to upload a Django app to heroku
Deploy a Python 3.6 / Django / Postgres web app on Azure
Write code to Unit Test a Python web app
Deploy a Django app made with PTVS on Azure
Quickly create a Python data analysis dashboard with Streamlit and deploy it to AWS
Deploy masonite app on Heroku 2020
Deploy django project to heroku
How to batch start a python program created with Jupyter notebook
A dentist (!?) Created a tongue coating amount judgment app with flask + keras
I made a web server with Raspberry Pi to watch anime
Run the app with Flask + Heroku
Web App Development Practice: Create a Shift Creation Page with Django! (Shift creation page)
Deploy a Django application with Docker
[Python] A memo to operate ROM created by GBDK with PyBoy
Try to make a web service-like guy with 3D markup language
Creating a simple app with flask
Deploy Flask app on heroku (bitterly)
Build a web application with Django
How to deploy a web application on Alibaba Cloud as a freelancer
Deploy a Python app on Google App Engine and integrate it with GitHub
Create a web app that can be easily visualized with Plotly Dash
Web App Development Practice: Create a Shift Creation Page with Django! (Introduction)
[Streamlit] I hate JavaScript, so I make a web application only with Python
A story about deploying a Twitter-linked app created using Flask + gunicorn on Heroku
Deploy flask app with mod_wsgi (using pipenv)
Create a GUI app with Python's Tkinter
Deploy the Django app on Heroku [Part 2]
Created a darts trip with python (news)
[Python] A quick web application with Bottle!
I can't deploy with google app engine
How to scrape websites created with SPA
I tried to make a Web API
Run a Python web application with Docker
Let's make a web framework with Python! (1)
Create a web service with Docker + Flask
Getting Started with Heroku, Deploying Flask App
Make a desktop app with Python with Electron
Let's make a web framework with Python! (2)
I made a WEB application with Django
Let's make an A to B conversion web application with Flask! From scratch ...
A web app that just does Hello World with Go's net / http package
I created a tool to correct GPS data with Mapbox Map Matching API (Mapbox Map Matching API)
[ES Lab] I tried to develop a WEB application with Python and Flask ②
Build a flask app made with tensorflow and dlib to work on centos7
WEB scraping with python and try to make a word cloud from reviews
Create a web app that converts PDF to text using Flask and PyPDF2
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer