Deploy Streamlit app on Heroku in less than 30 mins

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up everybody welcome to another video and in this video we'll be learning how we can deploy our extreme it apps on Heroku so if you don't know what stream it is I'm gonna give you a basic introduction so it's it's an open-source app framework for machine learning and data science teams we had beautiful data apps in hours not weeks all in pure Python so what it does is you've probably been making machine learning models using Python and you maybe you did maybe you didn't maybe you just want to shock start with it but most people who make machine learning models or who have made machine learning products they don't know how to deploy their projects on the web you know so for example what if I want I made a model which predicts something based on some input and I want to share it share it with a friend you know that that's not nearby who cannot access it on my computer so well if it's a technical guy then I can just send our entire file entire source code maybe the Jupiter notebook and just email it to them and they can try it but what if he's not a technical person if they're not a technical person then they would if you could just share a link with them with which they can use your app and that would be super convenient right that's extreme it comes in and it can help you deploy your machine learning models on the net so that you can easily access it from anywhere really so okay now we would be deploying our extreme it apps on Heroku right now what is it aku so here you can see that Heroku is a cloud platform as a service supporting several programming languages one of the first cloud platforms hello who has been in development since June 2007 when it's supported only the Ruby programming language but now it supports Java no js' gala closure Python PHP and go it probably does a bunch others which are not mentioned here anyway so why are we choosing the Roku because there is a bunch others out there because number one I've tried it and it works and we're to its it gives you a free option so you could sign up for a free account and then you can deploy up to five apps on there which is really cool I think for people who just want to try it also if you want to buy for buy a subscription then it's $25 starting I think you can check out the pricing too here let's see and yeah so for free it's a zero dollars for production free obviously zero dollar production $25.00 send-up per month and my answer is 250 dollars which has more features obviously an enterprise has probably even more cost based on your requirements right anyway that's enough introduction let's get right into it so I have written all the steps in this notepad and step number one is need to create a repository on your github it's not required but I'm going to include this step so that you have a backup of all your files on your github right so you can easily access all your files and edit and then if you want to change some things up on your built app already then it would be a lot easier so just to make your life easier I'm going to follow all these steps right I've tried a bunch of others but they were super I don't know like some of them I found more convoluted than than the others and this one I found the most straightforward one so we're going to do this one anyway so step number one is we're going to create a repository on github so let's go ahead and make one if you don't have a github account just make one and then make a new repository let's call it Tremlett go way up I guess okay let's give it a description as well our way you first oops it deployed on Heroku okay Blake let's initialize it with a readme as well and create repository okay it's creating one I'm going to close these tabs not required I'm going to clone this but you that probably it's in step one blown it in your PC right so I'm gonna have to clone it somewhere so I'm gonna own it here I'm gonna the folder let's I don't know let's just call it a new folder okay so here you can you would have to use the terminal or the command prompt in Windows so you do CMD right so here you would have to navigate to this folder which you can do easily by copying the path and then here you can just say CD there's the path and now you're into it right so here you would say git clone and then the link that you copied but I would have to copy it again I just copy the path so I copied it I'm gonna clone the repository it's cloning okay so here we have our thing now we would have to navigate to that folder think I'm get to that folder right so here you would say CB srimad lo app gets called right here into it so inside you have a dot git folder and you have read me yeah dot git folder might not be shown to you because this is a hidden file so if you have enabled the option it might show it might not don't worry about it if you have cloned it then it's it's there right that's me so next is make a file named named a plot PI okay so you will have to create a Python file why because you would be writing Python code so make sure that python is installed in your system obviously it would need that one you know idle and staking a lot of time okay let's make a new file then you would have to import stream it and I'm gonna make a super basic apps I wouldn't be putting anything else it's imported as HD so that it's easier we're gonna say give it a title if you're not familiar with the syntax of stream a then is yes you can check out the documentation is really cool if you check it out right probably making more videos about it so or you could find more videos on YouTube anyway if I don't so don't worry about it anyway you can use the Tiger function to give your to give it a title I'm gonna show how it looks in on our website so so we're gonna give it a title let's just say hello streamlet and after that let's just add a sub header it says welcome to my first stream neat app right let's save it so okay so I'm gonna have to save it here right so let's just copy the path again and I can just miss that they're okay right I'm gonna name it app you can name it anything really doesn't matter no for now I'm just gonna name it app okay I'll open the terminal again now I'm assuming that you have stream it installed in your system if you don't you can just do clip install and stream it and it's gonna install so they have it installed already so it's just going to tell me that it's installed right requirement already satisfied and all these things all these are libraries which are the dependencies of statement yeah it has a lot I know it's crazy anyway let me just clear the screen I'm gonna say stream it run have got PI what this would do is it would run my app but PI here and it would show how it would look on my browser it's gonna open up a local URL and see hello stream light welcome to my first stream it app now this is your first string meter app really but this is running on your localhost right now it's not deployed right so you can make a bunch of genius if you want to the app like for example let's say that you want to add a title maybe maybe text because you've already added title here you can say I don't know something some depth here yeah save that one and if you just go here and if you just refresh the page you can see that some text here appeared so it's a dynamic which is awesome right I mean you could you could be developing your app side by side you could constantly see what it looks like whenever you write something so maybe you made an error here let's say that you wrote something else which does not make sense you run that it's gonna give you an error even though this much is running because python is based on an interpreter right so all these three lines are executing well but the fourth line is giving you an error right so I'm just gonna go ahead and delete that wanna save that one again I'm gonna refresh so this looks ok this looks ok for my first extreme it app right so let's just go ahead and deploy it on the web perfect so I'm gonna close this I thought because I'm satisfied with it for now okay I'm gonna stop this running server by saying ctrl C let's stop let me just close that right now here what we need to do next is let's see she let me close by them as well okay now next step is and make a file named proc file okay so this is one of the requirements for a Heroku okay so now from now on we would be making things suitable for it to run on Heroku cinnamon on heroku's cloud platform right so you would have to make a file called proc file so for that you would have to open another notepad which I have opened already and here you can just paste this I already have it written so you don't have to worry about it ok so here what it does is it says web which means that it is a web app SH means it is going to run okay so the proc file actually specifies the command which is going to run when you try to execute your app on Heroku platform so this is going to run on heroku's internal server thingy right and it's gonna specify the type of setup dot as such which is a shell file right and we haven't created that one yet but we would be going to soon and this is an and operator and once we're done with this we're gonna run stream it run a plot pie which we just saw which runs our app right so you would have to save this you would have to call it it is num new folder right okay so you have to go all files and you're gonna have to say proc file and make sure that it decided exactly this with capsule Broc fi le and it my you note that might not let you save it without an extension so what you can do is you can put that with inputs if you save it now it's gonna just save it as a file and it's not going to give you an extension right so that one's done let's check out what's next now you have to make a file namely requirements dot txt ok let's open notepad again and here in the requirements file you will have to specify all the libraries that you are that you used in your app right so here we just you should stream it right so you can just say stream it and you can say it opens a txt so oh it is already there so requirements yeah I spell it correctly save it's there perfect ok next you need to make a file name is setup daughter such okay also by the way if you let's say that you installed more libraries let's say that you had numpy as well so you you can write numpy that and as you can say pandas if you had requests you can just say the quest and so on right so but here I we were just gonna use stream it and actually numpy and pandas are one of the dependencies of stream read but anyway so here we just have stream it specify for for our very basic app you just want to make the next file which is set up door as such so let's open notepad again here you can just paste this one right here so you don't have to buy a but this does exactly this is I'm sort of she'll come man which runs on heroku's platform when it is trying to deploy your app if you don't have this file it's gonna give you an error I'm telling you right now so don't forget this one don't forget any of those files actually but don't forget this one either so we're gonna save it we're gonna call it setup door as such and make sure that you call it setup that as such nothing else we're gonna do all files again save okay so we have a set uploaded such file there okay perfect now get done setting up things so we have all these five files and this one folder hit folder right so make sure that you have all these files before you proceed to the next step now the next step is you just go to your terminal or your man prompt whatever it is you're using based on your operating system so here you would say Heroku login well in order to use this command you would have to first install Heroku CLI which for Windows you can simply find it find out by saying hero who CLI if you say that you can simply download it windows it's obviously super straightforward download and install right so here you can download for Ubuntu or any I don't know if they probably have all the methods for all the versions that they support right so for Linux for a bunch of specifically you can just run this on your terminal or Mac you can just download the Installer or run this on your terminal again for Windows you can just download the Installer right and run it and install it right I already have it installed so I'm not going to download it again so here you can just say head oh cool login make sure that you have an account as well so once you run this it's gonna lead you to a page in the browser you just if any key except you you can open up the browser and then it would prompt you to login it should log me in because I already have an account and then it would ask you to return back to your CLI meaning command line interface right so you can close this page in return your CLI so here it says that I am logged in as my gmail account hey don't spam me I'm putting my gmail I'm not gonna blur it out or anything that's too much work but anyway the next step is let's see next you say Heroku create which kunal which is going to create an app for you so here you can do two things you can either just run this one just going to simply make an app for you it's gonna give it a default name something and no random like floating Plato or something like that or you can give it a name yourself whatever you like so here since our repository is called a stream it hello app I'm just gonna call it that one I'm gonna say srimad hello app even if you don't give it a name and you just say hello co-create it's gonna work perfectly fine so don't worry about giving it a name you don't have to think too much just run and if the name is available it's gonna create it okay so it's created already right next step is you have to add all the files all of these files oops sorry all of these files to your to the it have repository right to the Heroku repository actually which is separate so in the terminal or the command prompt you can just say git add dot or dude whatever you wanna call it it's adding those files now now you can just commit it is saying get to commit - m and here you can put a message first commit or something I don't know if you're not familiar with the git commands it's fine and also in order to use this you will have to you would need git bash installed for example here I could just right click and go and get here and I could just write my code there but maybe some of you don't have it installed that's why I'm doing it the more generic way right so you could just do it there anyway I'm gonna close that here you can just say git commit - M first commit it's gonna say for coming for files changed a file a papaya requirements and setup right those were the four files right 1 2 3 4 ok the the readme file is already on on your github right so it's mine it doesn't need to push that one here now you can say okay so there are two things you could just run git push which is going to tell of these things to your github repository we're not gonna do that yet what we're gonna do is we're gonna say git push Heroku after all right now so we are gonna put all these things to the Heroku master branch but we're not gonna push it to our directory right I'm gonna show it to you so that you believe me right so here they have nothing right now I'm gonna refresh the page for you okay now here you just do get hello goo master no it should chevre thing to the Heroku master thingy it says Python have detected and now it's gonna install all the things that's required right so just wait for it it's gonna install streamlet and all the dependencies and everything said the environment and everything if you miss any of these files it's gonna give you a bunch of errors and then you would have to watch my tutorial again right but I hopefully didn't miss anything so it's looking good so far now let's just wait here and pray that nothing goes wrong fingers crossed okay so it's installing a bunch of things looking good here we still have nothing you can see I'm gonna refresh the page again can close this tab okay so nothing again right so successfully built washed up linker validator stone arrow ok so it's oh my god so many dependencies but it does make your job a lot easier of the point everything to the internet so I guess it's fine okay now here you can see it says proc file declares types web right because we said we mentioned in our proc file that it was a web app right it could have been a different kind of crap you don't know I hate so you have to specify everything okay now it's done deploying you just I'm just waiting for a confirmation and then I'm gonna check out my app live so actually I can just copy the link right now and being impatient but maybe I'll just wait see what happens come on man do it already come on you can do this oh no no I should probably drop this part of the video right now but then I guess we're gonna miss my commentary so wow this is taking awfully long it did not take this long in my rehearsal videos what's he doing am I still gonna get to the Wi-Fi no I am I don't say it's 912 p.m. here it's smart it's 2:43 a.m. oh okay trim it'll help you calm come on okay let's see it works okay it's loading streamlet let's see perfect it's deployed now so this is your link now and you can well now you can do all sorts of things also like I said if you refresh the page you can say that nothing is here on your github yet so that if something went wrong during the deployment in Heroku it's not on your github so now you don't have to delete all the crap that you just wrote right so here if everything's all the things are right then you can just say git push I'm just gonna ask for your username and password but one sec it's pushing first oh wait a second because I'm already logged in right let's see the refresh again okay so five minutes ago Frick so it is here so this is your first app where's tap for stream you tap that you deploy it on Heroku go have fun with it make a bunch of things probably yeah sure you guys are gonna have a lot of fun I don't know I don't care anyway the video is out do what you want with it I'll see you in the next video and thanks for watching
Info
Channel: Bluecodes
Views: 14,573
Rating: 4.9741378 out of 5
Keywords: streamlit, heroku, streamlit heroku, python heroku, deploy machine learning app, python app deploy, deploy machine learning project on the web, how to use streamlit to create beautiful ml tools, streamlit apps, streamlit python, deploy python, deploy python web application, python mlmpython machine learning, machine learning using python, heroku streamlit, python streamlit heroku, streamlit tutorial, heroku tutorial, heroku python tutorial
Id: mQ7rGcE766k
Channel Id: undefined
Length: 22min 56sec (1376 seconds)
Published: Tue May 19 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.