How to Deploy a Streamlit App - Part 4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey and welcome to the fourth and the last video on building a web app for your data science project using streamlit so what we had so far was only to build our application and i can show you what we had or where we left off in the previous video we just need to run my application and this is what it looks like so i have a graph i have some explanations i can interact with it everything works because we implemented it already you can change this change this yeah everything works but the problem is i cannot share this application with someone else right now because it is not deployed and deployment means is basically put it somewhere on the internet it has a url that other people can reach it with so and there are a couple of steps to deployment uh deploying streamlined apps and we're going to go through those steps in this video the first step of deploying a streamlined app is actually getting an account from streamlit so if you go to streamlet.io sharing you will end up at this page and what you need to do is basically streamlet has this service where you can sign up for and they will give you an opportunity to deploy your app so that you don't have to create another account somewhere else i think a really popular way of doing it is using heroku i think they have some free plans where you can deploy some apps also some web apps like react and everything but streamlet basically has its own deployment environment all you need to do is request an invite to start sharing now so this is not something you can do right away you have to do this a little bit in advance um i think it took me three to four days for them to send me an invite doesn't take so long so you just need to fill this really simple form if you don't have a github url already it's fine they don't require it just your email and sign up now then once your email arrives it will look like this it actually has all the guidance for you but there are a couple of things that might be a little bit confusing about like you might not know what to do so i'm going to show you those so first thing is putting our code on github so you might have already put your code in github but maybe you haven't maybe you were just following this tutorial i haven't put it on github i haven't showed you how to do that so i'm going to show you to do that and then we're basically going to sign into streamlet share that's their service and we're going to deploy as you're going to see it's very simple so as they said the first thing we're going to do is to put our app on github but let's read the small text here it says make sure it is a public folder and we have a requirements.txt file so i do not have a requirement.txt file right now i only have my data here and then i also have my main application what requirements.txt does is basically you know when we import some libraries on our computer we also write it down in a requirement.txt file saying that i need this this and this library for this app to run and it's really easy to create this um requirements.txt file i'm just going to create a new terminal and go to my application again yes so this is my application folder uh it's very simple we just need to install this library called pip rex yeah and i already had it but if you didn't it will install it for you and the next thing you need to do is to say pip rex and you need to get a path to your application but i'm already in the folder where my application is so i'm just going to say dot slash and then it will create a requirements txt file for me and it's already here so you can see inside it just says this application needs panda streamlet and scikit-learn to be able to run that's all that's all we need okay so that means that now i can put my library to github it's going to create a new terminal file terminal window okay so we haven't created any github repository yet so first i'm going to have to do that i'm going to go to github and say new repository i will name it same as my folder so it's my awesome streamlet frontend my awesome streamlet front and i think i have a dash there huh yeah okay uh no description i will make sure that it's public no readme no git ignore nothing i do not add any other thing and i said create repository and i have a totally empty repository now all i need to do is to put my files from my local place to this remote repository okay so let's do this so i again need to navigate to where my files are and once i'm here i'm going to say git init and that basically initializes this folder as a git folder okay and after that i'm going to say add all of these files that are industry in this folder right now to my git and that's done too and i will do it like i'm commenting committing normally i'll just say first commit okay that's all and uh so normally this i mean this looks like you know pushing your changes to github but the difference is right now github doesn't know where to put these things so what i need to do is to say okay everything that you just added to git you need to add it to this url so i need to copy this link and then say git remote add origin and paste this link and that's all after that i need to do git push origin master and it will change all my i will push all my files to github and it's done let's see if they're already here awesome they're already here i have my data folder i have my main application python file and my requirements.txt if you're using mac you could also you might also see this extra file normally we added and get ignored to not include this file i don't even know what it exactly is it's just something that comes with mac folders you can just disregard it for now also you can just go and remove it if you like um but that's that's not a big deal we can just keep it from now on okay so my uh code is on github right now and all i need to do is to log in to streamlet sharing and deploy it and that's pretty simple they already sent me the link sign into stream at i o it's this simple it might it might prompt you to log in with your github account just make sure that when you're signing up for streamless sharing you are using the same email address that you use in your github account otherwise it cannot know it cannot connect to your github account so you will need to log in with your github and then say new app and yes this is my application my awesome stream is front end it's the master branch but the main file name for me is main dot pi if you remember here it's main.pi does where my application is and i say deploy and i think it's going to take a couple of minutes for it to fully deploy and then i'll be able to see my app online and it looks like my application is deployed so as you can see it's everything went well no errors no nothing and this is going to be my url so let's try it already here look at that i have a legit url that i can reach my application with and this is just running on streamless servers i don't know how they have everything figured out in the background but it looks like it's pretty simple for me so maybe you want to add this to your github repository so people who end up in your page can use this application so what you can do very easily is just to say create new file i'm going to say readme.md and you know my first streamlet project it's very awesome and i'm going to say you can reach the application here and i'm going to make this a link if i remember correctly how to make links on in markdown i think this should be it let's say commit yes and that's how that's how it works so you can share the link to your github repository so that someone who wants to see your work for example can go to main.pie and see okay oh this is her work or this is his work okay what does she do this is cool this looks nice and then if they also want to deploy it and see how it looks in real life then they can click this link they will end up at your application and that's all nothing else your application is uh deployed it's very simple i actually would like to thank streamlet folks from here for their service it is actually super super super useful makes everything very easy and it's just yeah amazing for especially data scientists or people who want to become data scientists that do not have um experience with deploying apps so this is just awesome thanks for watching the video i hope you enjoyed it and if you liked the video don't forget to give it a like and even maybe subscribe because i'm more or less here every week i'm trying to bring you the content about becoming a data scientist and don't forget to also go check out my website so you want to be a datascientist.com there i share weekly articles i have a podcast where i interview other data scientists and data professionals and i have free and paid resources i have courses on data science both for understanding where you want to go with data science and also getting practical hands-on experience on data science i mean that's actually the name of my course hands-on data science so go and check those out and i'll see you around
Info
Channel: Mısra Turp
Views: 5,382
Rating: 4.9813085 out of 5
Keywords:
Id: B0MUXtmSpiA
Channel Id: undefined
Length: 10min 57sec (657 seconds)
Published: Tue Dec 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.