Puting the Model Into Production: Web Apps


#1

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.


No matching distribution found for torch >=1.0.0
(Dhruv Thakur) #2

Zeit Now works for me (using Docker).


(Dhruv Thakur) #3

The resulting docker image is around 1.6gb in size.


(Arunoda Susiripala) #4

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


(Daniel Armstrong ) #5

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


(Arunoda Susiripala) #6

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


(Arunoda Susiripala) #7

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

You can find some python examplss as well.


#8

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


(Dhruv Thakur) #9

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"
    }
}

(Henri Palacci) #10

Maybe let’s try not to duplicate topics:

Production using models
thread started by Jeremy


(Bigyan Karki) #11

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!


(Jeremy Howard (Admin)) #12

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?


(Abi Komma) #13

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


(Arunoda Susiripala) #14

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.


(Jeremy Howard (Admin)) #15

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.


#16

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).


(WG) #17

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!


(Arunoda Susiripala) #18

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

That’s a good point.


(Arunoda Susiripala) #19

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

#20

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.