{"id":835,"date":"2022-08-22T13:38:00","date_gmt":"2022-08-22T08:08:00","guid":{"rendered":"https:\/\/geekpython.in\/?p=835"},"modified":"2023-08-15T16:32:11","modified_gmt":"2023-08-15T11:02:11","slug":"deploy-streamlit-webapp-to-heroku","status":"publish","type":"post","link":"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku","title":{"rendered":"How To Deploy Streamlit Webapp To Heroku &#8211; Complete Guide"},"content":{"rendered":"\n<p>Developers associated with data science or machine learning probably have web development skills. So they use a framework called&nbsp;<strong>Streamlit<\/strong>&nbsp;as a frontend source to serve their ML or Data Science web app.<\/p>\n\n\n\n<p><a target=\"_blank\" href=\"https:\/\/streamlit.io\/\" rel=\"noreferrer noopener\">Streamlit<\/a>&nbsp;is an open-source, accessible, and straightforward Python framework that allows us to create interactive UI for dashboards, Machine Learning, Data Visualization, and Data Science projects.<\/p>\n\n\n\n<p>Anyone with no experience in web development can generate an app using Streamlit though it requires some basic knowledge of Python. Data Scientists and Data Engineers often use Streamlit.<\/p>\n\n\n\n<p>Generating an app using Streamlit is achieved by adding a few streamlit function calls to the existing Python projects. Check out this article on&nbsp;<a target=\"_blank\" href=\"https:\/\/geekpython.in\/python-web-app-under-100-lines-of-code-using-streamlit\" rel=\"noreferrer noopener\">EDA and the data visualization web app using Streamlit<\/a>&nbsp;to learn how to build the frontend for your Python project using Streamlit.<\/p>\n\n\n\n<p>Once you&#8217;ve created an app, you probably want your project to be on the cloud so others can utilize it.<\/p>\n\n\n\n<p>In this tutorial, we will discuss how we can deploy the Streamlit application to&nbsp;<a target=\"_blank\" href=\"https:\/\/www.heroku.com\/\" rel=\"noreferrer noopener\">Heroku<\/a>, a platform as a service (<strong>PaaS<\/strong>) allowing us to host our applications entirely on the cloud.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-creating-a-streamlit-application\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-creating-a-streamlit-application\"><\/a>Creating a Streamlit Application<\/h2>\n\n\n\n<p>To deploy an app on Heroku, we need it first. I&#8217;ve previously created a Streamlit app&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/python-web-app-under-100-lines-of-code-using-streamlit\" target=\"_blank\"><strong><em>&#8220;Python: Web app under 100 lines of code using streamlit&#8221;<\/em><\/strong><\/a>&nbsp;and explained the process of making it in an article, but I haven&#8217;t covered the deployment process. So we&#8217;ll use that app and deploy it on Heroku.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \" title=\"app.py\"># Importing necessary libraries\nimport streamlit as st\nimport pandas as pd\nimport plotly.express as px\n\nst.title(\"Covid-19 EDA and Visualization\")\n\nst.markdown('''\nA Web App to visualize and analyze the Covid-19 data from India\n* **Libraries Used:** Streamlit, Pandas, Plotly\n* **Data Source:** Kaggle\n''')\n# Inserting Image\nst.image('Covid-Banner.png', caption=\"Image by Sachin\")\n# Reading csv data\ndata = pd.read_csv('Covid-19.csv')\n# Displaying Data and its Shape\nst.write(\"**Covid-19 dataset**\", data)\nst.write(\"Shape of data\", data.shape)\n# Header of sidebar\nst.sidebar.header(\"User Input\")\n# Creating selectbox for Graphs &amp; Plots\ngraphs = st.sidebar.selectbox(\"Graphs &amp; Plots\", (\"Bar Graph\", \"Scatter Plot\", \"HeatMap\", \"Pie Chart\"))\n# Sorting the columns\nindex = sorted(data.columns.unique())\n# Setting default value for x, y, and color\ndefault_index_x = index.index('State\/UTs')\ndefault_index_y = index.index('Total Cases')\ndefault_index_col = index.index('Death Ratio (%)')\n\n# Creating selectbox for x, y and color label and setting default value\nx_label = st.sidebar.selectbox(\"X label Parameter\", index, index=default_index_x)\ny_label = st.sidebar.selectbox(\"Y label Parameter\", index, index=default_index_y)\ncol = st.sidebar.selectbox(\"Color\", index, index=default_index_col)\n\nst.markdown('''\n## **Visualization**\n''')\n\n# Caching the function\n@st.cache(suppress_st_warning=True)\n# function to plot graphs\ndef visualize_plotly(graph):\n    if graph == \"Bar Graph\":\n        st.write(graph)\n        fig = px.bar(data, x=x_label, y=y_label, color=col)\n\n    elif graph == \"Scatter Plot\":\n        st.write(graph)\n        fig = px.scatter(data, x=x_label, y=y_label, color=col)\n\n    elif graph == \"HeatMap\":\n        st.write(graph)\n        fig = px.density_heatmap(data, x=x_label, y=y_label, nbinsx=20, nbinsy=20)\n\n    else:\n        st.write(graph)\n        fig = px.pie(data, values=x_label, names=data[y_label])\n\n    return fig\n\nfigure = visualize_plotly(graphs)\nst.plotly_chart(figure)\n\nst.markdown('''\n## **Report**\n''')\n# Creating buttons to display reports\nif st.button(\"Highest Cases\"):\n    st.header(\"Highest Cases in a State\/UT\")\n    highest_cases = data[data['Total Cases'] == max(data['Total Cases'])]\n    st.write(highest_cases)\n\nif st.button(\"Lowest Cases\"):\n    st.header(\"Lowest Cases in a State\/UT\")\n    lowest_cases = data[data['Total Cases'] == min(data['Total Cases'])]\n    st.write(lowest_cases)\n\nif st.button(\"Highest Active Cases\"):\n    st.header(\"Highest Active Cases in a State\/UT\")\n    high_active_cases = data[data['Active'] == max(data['Active'])]\n    st.write(high_active_cases)\n\nif st.button(\"Lowest Active Cases\"):\n    st.header(\"Lowest Active Cases in a State\/UT\")\n    low_active_cases = data[data['Total Cases'] == min(data['Total Cases'])]\n    st.write(low_active_cases)\n\nif st.button(\"Highest Death Ratio (%)\"):\n    st.header(\"Highest Death Ratio (%) in a State\/UT\")\n    high_death = data[data['Death Ratio (%)'] == max(data['Death Ratio (%)'])]\n    st.write(high_death)\n\nif st.button(\"Lowest Death Ratio (%)\"):\n    st.header(\"Lowest Death Ratio (%) in a State\/UT\")\n    low_death = data[data['Death Ratio (%)'] == min(data['Death Ratio (%)'])]\n    st.write(low_death)<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-creating-required-files\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-creating-required-files\"><\/a>Creating Required files<\/h1>\n\n\n\n<p>We need to add some files in the app&#8217;s root directory that allow Heroku to install the requirements and run the application.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-requirementstxt-file\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-requirementstxt-file\"><\/a>requirements.txt file<\/h3>\n\n\n\n<p>The&nbsp;<em>requirements.txt<\/em>&nbsp;file contains all the libraries that are used in the project or need to be installed for the project to work. We can create it manually or use a Python library called&nbsp;<code>pipreqs<\/code>&nbsp;which will automatically create a&nbsp;<strong><em>requirements.txt<\/em><\/strong>&nbsp;file.<\/p>\n\n\n\n<p>To generate a&nbsp;<strong><em>requirements.txt<\/em><\/strong>&nbsp;file.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">pipreqs &lt;project-directory-path&gt;<\/pre><\/div>\n\n\n\n<p>The requirements file should look something like the following:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">pandas==1.4.3\nplotly==5.10.0\nstreamlit==1.12.0<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-setupsh-and-procfile\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-setupsh-and-procfile\"><\/a>setup.sh\u00a0and Procfile<\/h3>\n\n\n\n<p><code>setup.sh<\/code>&nbsp;and Procfile is used to tell Heroku the needed commands for running the application.<\/p>\n\n\n\n<p>In the&nbsp;<code>setup.sh<\/code>&nbsp;file, we&#8217;ll add the following code that creates a streamlit folder with a&nbsp;<code>credentials.toml<\/code>&nbsp;and a&nbsp;<code>config.toml<\/code>&nbsp;file.<\/p>\n\n\n\n<p><code>setup.sh<\/code>&nbsp;file<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:sh decode:true \" title=\"setup.sh\">mkdir -p ~\/.streamlit\/\n\necho \"\\\n[general]\\n\\\nemail = \\\"your-email@domain.com\\\"\\n\\\n\" &gt; ~\/.streamlit\/credentials.toml\n\necho \"\\\n[server]\\n\\\nheadless = true\\n\\\nenableCORS=false\\n\\\nport = $PORT\\n\\\n\" &gt; ~\/.streamlit\/config.toml<\/pre><\/div>\n\n\n\n<p>Now we&#8217;ll create a&nbsp;<strong>Procfile<\/strong>&nbsp;that specifies the commands executed by the app on the startup.<\/p>\n\n\n\n<p>In the command below, Procfile executes the&nbsp;<code>setup.sh<\/code>&nbsp;file and then calls&nbsp;<code>streamlit run<\/code>&nbsp;to run the application.<\/p>\n\n\n\n<p><code>Procfile<\/code>&nbsp;file<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:sh decode:true \" title=\"Procfile\">web: sh setup.sh &amp;&amp; streamlit run app.py<\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-creating-a-github-repository\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-creating-a-github-repository\"><\/a>Creating a GitHub repository<\/h1>\n\n\n\n<p>Now, it&#8217;s time to push the code to&nbsp;<strong>GitHub<\/strong>. If you haven&#8217;t created a GitHub repository, then log in to your GitHub account and follow the steps below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"564\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/1-1.png\" alt=\"New Repository\" class=\"wp-image-838\"\/><\/figure>\n\n\n\n<p>Type the repository name and hit the &#8220;<strong>Create repository<\/strong>&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"510\" height=\"586\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/2-2.png\" alt=\"Creating GitHub Repo\" class=\"wp-image-840\"\/><\/figure>\n\n\n\n<p>Now that you&#8217;ve created a GitHub repository, it&#8217;s time to commit and push the code to the repository. Move to the&nbsp;<code>app.py<\/code>&nbsp;directory and&nbsp;<strong>copy-paste the following command into your terminal<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \" title=\"git commands\">echo \"# Streamlit-App\" &gt;&gt; README.md\ngit init\ngit add . \ngit commit -m \"first commit\"\ngit branch -M main\ngit remote add origin https:\/\/github.com\/your-github-username\/repository-name.git\ngit push -u origin main<\/pre><\/div>\n\n\n\n<p>Here, a git repo will be initialized in the current directory, and instead of adding&nbsp;<code>git add README.md<\/code>, we&#8217;re running&nbsp;<code>git add .<\/code>&nbsp;to stage all the files in our current directory.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-deploying-to-heroku\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-deploying-to-heroku\"><\/a>Deploying to Heroku<\/h1>\n\n\n\n<p>We need a Heroku account to deploy any application on their platform. In general, Heroku is free to use but to get more features, we&#8217;ll have to pay.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-creating-a-heroku-account\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-creating-a-heroku-account\"><\/a>Creating a Heroku account<\/h2>\n\n\n\n<p>To create an account on Heroku, click&nbsp;<a target=\"_blank\" href=\"https:\/\/signup.heroku.com\/\" rel=\"noreferrer noopener\">here<\/a>. I&#8217;ve already created an account, so I&#8217;ll log in to my account.<\/p>\n\n\n\n<p>There are two methods to deploy applications on Heroku:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Using Heroku UI (Manually)<\/li>\n\n\n\n<li>Using Heroku CLI<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-using-heroku-ui-manually\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-using-heroku-ui-manually\"><\/a>Using Heroku UI (Manually)<\/h2>\n\n\n\n<p>Using Heroku UI, we can manually deploy our application by performing the below steps.<\/p>\n\n\n\n<p>Click on the &#8220;<strong>Create new app<\/strong>&#8221; to create a new app.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"246\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/3-1.png\" alt=\"Creating Heroku App\" class=\"wp-image-841\"\/><\/figure>\n\n\n\n<p>Then enter the name of the app and then hit &#8220;<strong>Create app<\/strong>&#8221; to move on to the next step.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"946\" height=\"443\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/4-1.png\" alt=\"Configuring App Details\" class=\"wp-image-842\"\/><\/figure>\n\n\n\n<p>Click on the &#8220;<strong>GitHub<\/strong>&#8221; option to connect to GitHub on Heroku, search for&nbsp;<strong>application repository<\/strong>, and hit &#8220;<strong>Connect<\/strong>&#8220;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"405\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/5-1.png\" alt=\"Uploading GitHub Repo on Heroku Server\" class=\"wp-image-843\"\/><\/figure>\n\n\n\n<p>In the last step, click &#8220;<strong>Enable Automatic Deploys<\/strong>&#8220;, select the branch, and hit &#8220;<strong>Deploy Branch<\/strong>&#8220;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"854\" height=\"444\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/6-1.png\" alt=\"Deploying Repo\" class=\"wp-image-844\"\/><\/figure>\n\n\n\n<p>Now, wait until Heroku completes the build process of our application and deploys it on the cloud. After completing the deployment process, we can see our application live on the cloud. Here you can see the application&nbsp;<a target=\"_blank\" href=\"https:\/\/covid19visualization.herokuapp.com\/\" rel=\"noreferrer noopener\">covid19visualization<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1351\" height=\"609\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/banner.png\" alt=\"Live App\" class=\"wp-image-701\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-using-heroku-cli\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-using-heroku-cli\"><\/a>Using Heroku CLI<\/h2>\n\n\n\n<p>To deploy our application on Heroku from the terminal, we need to download the&nbsp;<a target=\"_blank\" href=\"https:\/\/devcenter.heroku.com\/articles\/heroku-cli#install-the-heroku-cli\" rel=\"noreferrer noopener\">Heroku CLI<\/a>. Heroku CLI requires Git. If you haven&#8217;t installed it yet, then complete the&nbsp;<a target=\"_blank\" href=\"https:\/\/git-scm.com\/book\/en\/v2\/Getting-Started-Installing-Git\" rel=\"noreferrer noopener\">Git installation<\/a>&nbsp;or refer to this article on&nbsp;<a target=\"_blank\" href=\"https:\/\/devcenter.heroku.com\/articles\/getting-started-with-python#set-up\" rel=\"noreferrer noopener\">Getting Started on Heroku with Python<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"heading-log-in-to-heroku\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-log-in-to-heroku\"><\/a>Log in to Heroku<\/h4>\n\n\n\n<p>After setting up the Heroku CLI, we can log in to the Heroku account. Open your terminal, move to the&nbsp;<code>app.py<\/code>&nbsp;directory, and run the&nbsp;<code>heroku login<\/code>&nbsp;command. You will be asked to press any key, redirecting you to the&nbsp;<strong><em>Login<\/em><\/strong>&nbsp;window.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS D:\\SACHIN\\VS_projects\\streamlit\\Covid-19_EDA App&gt; heroku login\nheroku: Press any key to open up the browser to login or q to exit: \nOpening browser to https:\/\/cli-auth.heroku.com\/auth\/cli\/browser\/1f44be15-907a-4c85-8490-9f6f66e5830e?requestor=SFMyNTY.g2gDbQAAAA4xNTcuMzcuMTU2LjEyMm4GAEjfTbaCAWIAAVGA.ja9bfS30WQXj7SoiyTzMwxN6Ryvo3RSJF4BhaPWqe8o     \nLogging in... done\nLogged in as &lt;your-username&gt;<\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"945\" height=\"383\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/8-1.png\" alt=\"Heroku CLI Login\" class=\"wp-image-845\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-deploying-the-app\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-deploying-the-app\"><\/a>Deploying the app<\/h2>\n\n\n\n<p>After the log-in process, we need to create a Heroku instance for the app by using the command&nbsp;<code>heroku create<\/code>&nbsp;in the terminal.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">heroku create &lt;your-app-name&gt;<\/pre><\/div>\n\n\n\n<p>It&#8217;s your choice to type a name for your app otherwise just run the&nbsp;<code>heroku create<\/code>&nbsp;command.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1218\" height=\"195\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/9-1.png\" alt=\"Creating Heroku App uisng CLI\" class=\"wp-image-846\"\/><\/figure>\n\n\n\n<p>Push the code using the following command to that instance.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">git add .\ngit commit -m \"commit message\"\ngit push heroku master<\/pre><\/div>\n\n\n\n<p>After running the command&nbsp;<code>git push heroku master<\/code>, Heroku will automatically detect that it is a Python app and installs the packages from the&nbsp;<code>requirements.txt<\/code>&nbsp;file. After completing the build process, we can see the following log in the terminal.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \">remote: -----&gt; Discovering process types\nremote:        Procfile declares types -&gt; web\nremote:\nremote: -----&gt; Compressing...\nremote:        Done: 142.4M\nremote: -----&gt; Launching...\nremote:        https:\/\/covid19visualization.herokuapp.com\/ deployed to Heroku\nremote: This app is using the Heroku-20 stack, however a newer stack is available.\nremote: To upgrade to Heroku-22, see:\nremote: https:\/\/devcenter.heroku.com\/articles\/upgrading-to-the-latest-stack\nremote:\nremote: Verifying deploy... done.\nTo https:\/\/git.heroku.com\/covid19visualization.git\n * [new branch]      master -&gt; master<\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>This app is using the Heroku-20 stack which is an old stack, however, we can upgrade to Heroku-22 which is a newer stack. Here&#8217;s&nbsp;<a target=\"_blank\" href=\"https:\/\/devcenter.heroku.com\/articles\/upgrading-to-the-latest-stack#upgrading-an-app\" rel=\"noreferrer noopener\">how to upgrade an app stack<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"heading-checking-if-the-app-is-running\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-checking-if-the-app-is-running\"><\/a>Checking if the app is running<\/h4>\n\n\n\n<p>Now we can check if our app is deployed successfully and running on the web using&nbsp;<code>heroku ps:scale web=1<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1204\" height=\"81\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/10-1.png\" alt=\"Checking Application Status\" class=\"wp-image-847\"\/><\/figure>\n\n\n\n<p>Finally, run the command&nbsp;<code>heroku open<\/code>&nbsp;and this will open the app using your default browser, or manually enter the&nbsp;<strong>app&#8217;s URL<\/strong>&nbsp;in the browser to open the application.<\/p>\n\n\n\n<p>Visit my GitHub repository for&nbsp;<a target=\"_blank\" href=\"https:\/\/github.com\/Sachin-crypto\/Streamlit-Apps\" rel=\"noreferrer noopener\">Source Code<\/a>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-conclusion\"><a href=\"https:\/\/geekpython.in\/deploy-streamlit-webapp-to-heroku#heading-conclusion\"><\/a>Conclusion<\/h1>\n\n\n\n<p>We&#8217;ve learned how to deploy a Streamlit app on Heroku using two methods.<\/p>\n\n\n\n<p>The first method we used is Heroku UI or manually deploying our app from the Heroku website by performing some simple steps.<\/p>\n\n\n\n<p>The second method we used is Heroku CLI, Heroku&nbsp;<strong>C<\/strong>ommand&nbsp;<strong>L<\/strong>ine&nbsp;<strong>I<\/strong>nterface helps us perform the deployment process completely from the terminal.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>That&#8217;s all for now<\/strong>.<\/p>\n\n\n\n<p><strong>Keep Coding\u270c\u270c<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Developers associated with data science or machine learning probably have web development skills. So they use a framework called&nbsp;Streamlit&nbsp;as a frontend source to serve their ML or Data Science web app. Streamlit&nbsp;is an open-source, accessible, and straightforward Python framework that allows us to create interactive UI for dashboards, Machine Learning, Data Visualization, and Data Science [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":848,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[2,34],"tags":[47,31,35,48],"class_list":["post-835","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-streamlit","tag-heroku","tag-python3","tag-streamlit","tag-webapp","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":4,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"predecessor-version":[{"id":1363,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/835\/revisions\/1363"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/848"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}