Simplest web deployment

i’ve been looking at the different options for web deployment and getting a headache.

20 years ago i’d have uploaded my model and written one file which looked like this:

<%@ LANGUAGE = Python%>
<html>
    <head></head>
    <body>
    <h1>Bear Classifier</h1>
    <%
        #cut & paste about 10 lines of code in here 
        Response.Write("This bear is a...")
    %>
    </body>
</html>

the progress we’ve made since the late 90s is depressing. i understand why things get packaged up into services the way they do now, i was there before you could do all that and it wasn’t always fun, but sometimes all you need is the code above, and i don’t seem to be able to bang up anything that simple without a deployment guide 2 pages long. :confounded:

anyway, enough whinging, given what i actually want to do which is more or less still ^that^ up there) what’s the quickest, simplest framework and/or deployment site to go and learn?

Starlette is what fastai used to use, and it’s somewhat like you describe.

See my v2 starter code (based on v1):

The exact method that does predictions is the predict. Starlette is an overarching framework of course. But in regards to “simplicity” and still using the fastai library it’s a good one.

3 Likes

OK, I’m very happy now having discovered Binder and Voila.

For anyone who doesn’t know what that is, it pretty much renders your notebook as a webpage which is perfectly adequate for my “look what i just made” purposes.

Step 1: Add your notebook to a github repo like this:

Step 2: add a requirements.txt with all the installs you need (you may not need ipywidgets but you need the rest as a minimum). Don’t do any pip installs in your notebook.

Step 3: Go to mybinder.org and fill in the gaps (make sure you change the voila box from a file path to a url)


The first time it runs (or when you change your code) it’ll take a while to build but subsequent launches are much faster.

You end up with something like this:

Thank you to Jeremy and Sylvain because I discovered Binder through the book. :heart:

3 Likes