Puting the Model Into Production: Web Apps

Has anyone been able to successfully build a web application? What server did you use? Pythonanywhere’s free plan can only hold up to 512 MB so just with the pip install of the fastai library, it is full. And Heroku won’t allow me to git push any of my python files for some reason. Something about it doesn’t understand the type of application being pushed.

8 Likes

Zeit Now works for me (using Docker).

3 Likes

The resulting docker image is around 1.6gb in size.

2 Likes

Yep. You can use zeit now.
If you need help or any blocker, just ping me.
I work at ZEIT :smiley:

9 Likes

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.