Puting the Model Into Production: Web Apps

Do you have any tutorials on how we can use zeit to make a web app?

2 Likes

Start here: https://zeit.co/docs

3 Likes

And here is the examples directory: https://github.com/zeit/now-examples

You can find some python examplss as well.

3 Likes

this means that it can’t be deployed on “free” plan?

It can be used on the free plan. But due to the large image size, you’ll have to use version 1 of the platform. (I think v2 has restrictions on the size). ie, your now.json should have:

{
    "features": {
        "cloud": "v1"
    }
}
5 Likes

Maybe let’s try not to duplicate topics:

Production using models
thread started by Jeremy

I used the flask to build a simple web app. And, I used Heroku to host it. It is pretty straightforward to host flask in Heroku. For some reason Heroku does not install OpenCv. But, after using a buildpack and an aptfile, it worked. The code can be found here. Let me know if you need any help. Good luck!

5 Likes

I tried looking thru the Zeit docs but didn’t find it obvious how to create a docker app. If anyone has, or can create, a simple step by step guide for fast.ai students that would be really helpful! Or maybe even a little script to automate it?

2 Likes

I used simonw's instructions to successfully deploy a cougar or not clone on Zeit now using the v1 platform hack. He has it clearly documented at: https://github.com/simonw/cougar-or-not

3 Likes

Hey, there’s no big steps on creating a Docker deployment.
Just create a Dockerfile. Then go to that directory and run the now command.

Since we’ve a large image size we need to set the version to “1”. With version 2 we get some optimizations. But it’s totally fine to use the version “1”.

To force the deployment to version 1, simply add a file called now.json along with the Dockerfile and add the following content:


{
    "features": {
        "cloud": "v1"
    }
}

Above simonw's example is a pretty solid one.

I would guess that most students have not previously created a Dockerfile. So I don’t think this counts as a simple step by step guide for fast.ai students.

So I’d still appreciate it if anyone is able/interested in creating such a thing.

11 Likes

I’m getting this error when I try to deploy my directory and it’s uploading my first file

Error: File size limit exceeded (5 MB) (400).

2 Likes

One thing I’ve noticed is that apps deployed to v1 wake up very slowly … for example, when I make an API call to my frozen image, my requests timeout even with a 45 second window.

I’m loving ZEIT but wondering if there is a way to speed up ‘wake ups’. If you have other suggestions I’m glad to hear them.

Thanks!

1 Like

I would guess that most students have not previously created a Dockerfile

That’s a good point.

1 Like

This is the reason why we introduce v2.
But you can force to stop sleeping by scaling the deploying to “1”.

If the deployment is aliased to “http://myapp.now.sh”, then run following command:

now scale myapp.now.sh sfo 1
3 Likes

How do we upload a file greater than 5 MB? The file that includes the weights is 82.3 MB.

Edit: Found the answer. You’d have to upgrade to the $15 plan https://zeit.co/account/plan.

If there is a good tutorial about how to put your model into the internet using dockerfile or anything else please share the link here. I haven’t found any and I’m not even sure where I should start.

4 Likes

I don’t know about dockerfiles, but the most straightforward host for me to work with has been pythonanywhere.com. You’d have to upgrade to the $12/month plan to be able to store 5 GB of files.

Thanks Mauro. That seems cool site and maybe I will use it. Can someone with knowledge of dockerfiles tell us why dockerfiles might be better option? I don’t like price of this service. I’m also worried that in case of my software gets millions of users how this site could handle it.

Unfortunately the approach that @simonw demonstrated only works on v1. AFAIK there’s no examples yet of a way to deploy on v2 without spending a lot of money.

2 Likes