How to Deploy an AI App Locally: Step-by-Step Guide for Beginners
ML in Production (P1)
📚Chapter:1- App Development
Introduction
In this tutorial, we’ll walk through the steps to deploy a Python-based AI application on a local server, making it accessible to other PCs in your network. This guide covers downloading the necessary datasets, setting up the development environment, and installing required packages for a seamless deployment.
To deploy the built application to another local PC, follow these steps for a smooth setup.
Sections
Download the Necessary Datasets
Set Up the Required Tools
Install Python 3.9.0
Download Complete Code
Install the Required Python Packages
Expected Error and their solution
Finalizing the Local Server Deployment
Conclusion
Step 1: Download the Necessary Datasets
Before deploying the app, you’ll need to download the datasets it relies on. For example, in our project, Build Chatbot system These datasets contain important information like FAQs and intents for NLP (Natural Language Processing) functionality, essential for chatbot applications.
Start by downloading the necessary datasets for the app from the following links:
Dataset 1: FAQ Dataset
Dataset 2: Latest Intent File
Ensure that you have both datasets saved and ready for use in the application.
Step 2: Set Up the Required Tools
To run the application effectively, you’ll need to install and configure certain tools. Here’s what to download and set up:
1. Install Visual Studio Code (VS Code)
VS Code is a powerful code editor that will allow you to configure and run your Python app efficiently.
Download VS Code from the official website.
Install VS Code by following the on-screen instructions.
Set up Python in VS Code by following this Python configuration tutorial (or the tutorial relevant to your setup).
2. Install Python 3.9.0
For compatibility reasons, the app requires Python version 3.9.0. Ensure you have this version installed to avoid errors.
Download Python 3.9.0 from the Python release page.
Run the installer and follow the instructions for setup.
Make sure to add Python to your PATH during installation, as this is essential for running Python commands from the command line.
Python 3.9.0: Download Python 3.9.0 from this link. Install it according to the instructions provided. You may also find download links on Google Drive or GitHub if provided.
After installing Python, verify the installation by running:
python --version
Steps 3- Download Complete Code
Download the complete code of python app and unzip in some folder
Step 4: Install the Required Python Packages
With VS Code and Python 3.9.0 installed, the next step is to install the necessary packages that the app depends on. These packages are specified in a requirements.txt
file within your project directory. Here’s how to install them:
Important Note
Do not install the packages using the PC’s general command prompt. Instead, use the VS Code terminal. Installing packages from the wrong environment may lead to compatibility issues and errors.
Installation Steps
Open VS Code.
In the VS Code terminal, navigate to the folder where your
requirements.txt
file is located. You can do this by running:
cd path/to/your/project/folder
Once in the correct directory, run the following command to install all the required packages:
pip install -r requirements.txt
This command reads the requirements.txt
file and installs each package listed, ensuring that your app has all the necessary dependencies.
Expected Error and their solution
After install the required package you will face following error
Error 2: Could not find DLL ‘msvcp140_1.dll
Solution:1
Click on
https://www.dll-files.com/
.
Search msvcp140_1.dll.
Download and extract zip folder.
Copy msvcp140_1.dll and paste in C:\Windows\System32
Error 2: cannot import name ‘url_quote’ from ‘werkzeug.url’
Solution:1
Open your terminal or command prompt.
Run following command.
pip install werkzeug==2.2.2
Solution 2:
The error Could not find the DLL MSVCP140_1.DLL often occurs when a required Microsoft Visual C++ Redistributable is missing. This is particularly common with TensorFlow installations on Windows.
To resolve this issue, follow these steps:
Install the Microsoft Visual C++ Redistributable (x64 and x86) for Visual Studio 2015, 2017, 2019, and 2022:
Go to the Microsoft Visual C++ Redistributable download page.
Download the appropriate installer (vc_redist.x64.exe for 64-bit or vc_redist.x86.exe for 32-bit, or install both if you’re unsure).
Finalizing the Local Server Deployment
After completing these steps, your Python app is ready to run on the local server. Here are a few additional tips to ensure smooth deployment:
Double-Check Dependencies: Make sure all dependencies installed correctly. If any errors arise, double-check the
requirements.txt
file or reinstall specific packages as needed.Run and Test the Application: Launch the app on your local server and test it from other PCs on the same network to confirm that it’s accessible and functioning as expected.
Monitor for Errors: Keep the VS Code terminal open to monitor any runtime errors or warnings that may appear as other users interact with the application.
Conclusion
Deploying a Python-based AI application on a local server is straightforward when following these steps. By setting up the necessary datasets, configuring the development environment with VS Code and Python, and installing all required packages, you’ll be ready to run your app locally and provide a robust, AI-powered experience.
If you found this guide helpful, consider sharing it with others! Additionally, if you encounter any issues or have questions about specific steps, feel free to open an issue on GitHub or reach out for assistance.
Let’s connect: If you found this helpful, share your thoughts or questions in the comments! 😊
Please Follow and Subscribe Courses teach to see latest updates on this story
🚀 Elevate Your Data Skills with Coursesteach! 🚀
Ready to dive into Python, Machine Learning, Data Science, Statistics, Linear Algebra, Computer Vision, and Research? Coursesteach has you covered!
🔍 Python, 🤖 ML, 📊 Stats, ➕ Linear Algebra, 👁️🗨️ Computer Vision, 🔬 Research — all in one place!
Don’t Miss Out on This Exclusive Opportunity to Enhance Your Skill Set! Enroll Today 🌟 at
Understanding of Machine Learning Course!
Artificial Intelligence Career Advice Course
Stay tuned for our upcoming articles because we research end to end , where we will explore specific topics related to Machine Learning in more detail!
🔍 Explore Tools, Python libraries for ML, Slides, Source Code, Free Machine Learning Courses from Top Universities and More!
Remember, learning is a continuous process. So keep learning and keep creating and Sharing with others!💻✌️
Note:if you are a Machine Learning export and have some good suggestions to improve this blog to share, you write comments and contribute.
if you need more update about Machine Learning and want to contribute then following and enroll in following
👉Course: Machine Learning (ML)
Contribution: We would love your help in making coursesteach community even better! If you want to contribute in some courses , or if you have any suggestions for improvement in any coursesteach content, feel free to contact and follow.
Together, let’s make this the best AI learning Community! 🚀
Author
Acknowledgments for this article are due to the following author, who dedicated their time, expertise, and effort to Coursesteach Community.
Author: Samman Arooj(Github), Final Year Graduate at Virtual University of Pakistan