Deploy Streamlit on Azure Web App by info.odysseyx@gmail.com October 22, 2024 written by info.odysseyx@gmail.com October 22, 2024 0 comment 11 views 11 Streamlit is an open source app framework that allows you to create data-driven web applications with minimal coding. It’s especially popular for machine learning and AI-related projects because it allows developers to easily create interactive dashboards directly from Python scripts. this tutorial Walks you through the process of deploying a Streamlit application locally and to an Azure web app, including considerations for memory usage during deployment. index: Hosted in a development environment Hosted on Azure Web App Module and memory usage References Hosted in a development environment To run a Streamlit application in your local development environment, follow these steps: Step 1: Open an empty folder using VSCode. Launch a terminal and enter the following command to create a Python virtual environment and switch the current session to this environment. windows python -m venv .venv .\.venv\Scripts\Activate.ps1 linux python -m venv .venv source .venv/Scripts/activate Step 2: Enter the pip command to install streamlit and create a file called “app.py”. Run another command to start the local server hosting your project. You can then visit the project page in your browser. http://127.0.0.1:8501. # Install Streamlit pip install streamlit # Launch server after app.py has been created python -m streamlit run app.py Hosted on Azure Web App To deploy a Streamlit application to Azure Web App, follow these general steps: Step 1: Create a Linux Python web app on Azure. Step 2: Using VSCode, add two files: “streamlit.sh” and “.deployment” to the root directory of your project. streamlit.sh pip install streamlit python -m streamlit run app.py --server.port 8000 --server.address 0.0.0.0 .deployment [config] SCM_DO_BUILD_DURING_DEPLOYMENT=false Step 3: Using VSCode, deploy the root directory of your project into the Python app you just created. Step 4: Find your Python app in Azure, modify the launch command as follows, and then restart the app: bash /home/site/wwwroot/streamlit.sh Step 5: Make sure your project is running correctly. Module and memory usage Streamlit itself is a simple pip command (pip install streamlit) has several dependencies related to AI and machine learning libraries. These dependencies can consume significant amounts of memory, especially during the deployment process and when running Streamlit applications. If your application process terminates unexpectedly or throws exit code 137, this usually indicates that your web app is running low on available memory. In these cases, we recommend upgrading to a higher SKU with more memory to ensure smooth deployment and operation. Examples include: References Azure Linux web app and http server – Microsoft Community Hub Deploy Mkdocs Pages to Azure Web App – Microsoft Community Hub Install Streamlit using the command line – Streamlit Docs Troubleshooting Python function apps in Azure Functions | microsoft run python – Azure function exit code: 137 | Please review requirements.txt Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post Unlocking next-generation AI capabilities with healthcare AI models next post Register for the .NET Conf 2024 12 -14 Nov and the .NET Student Zone 18 & 19th Nov You may also like 7 Disturbing Tech Trends of 2024 December 19, 2024 AI on phones fails to impress Apple, Samsung users: Survey December 18, 2024 Standout technology products of 2024 December 16, 2024 Is Intel Equivalent to Tech Industry 2024 NY Giant? December 12, 2024 Google’s Willow chip marks breakthrough in quantum computing December 11, 2024 Job seekers are targeted in mobile phishing campaigns December 10, 2024 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.