ЁЯЪА

Deploying Machine Learning Projects Using Render

Jul 20, 2024

Youtube2 Project Overview by Nitesh

Introduction

  • Presenter: Nitesh
  • Topic: Deploying Machine Learning Projects using Render
  • Project Type: Hobby-level and portfolio-building projects

Issues with Previous Platform (Roku)

  • Roku previously offered a free-tier service, making it accessible for individuals without a company setup.
  • Roku's free tier has been discontinued.
  • New deployment on Roku now requires payment, which is problematic for students or hobbyists.

Solution: Render

  • Render Platform: Offers a free tier similar to Roku
  • Suitable for hobby and portfolio projects
  • Easier deployment compared to Roku
  • Handles machine learning projects efficiently

Step-by-Step Guide

Step 1: Machine Learning Model Preparation

  1. Toy Problem: Predicting student placement based on features (IQ, CGPA, 10th & 12th marks, communication skills).

  2. Dataset: Toy dataset with 100 rows.

  3. Model Used: Random Forest Classifier

  4. Process:

    • Import libraries
    • Export library versions for consistency
    • Import and prepare data
    • Split data into training and testing sets
    • Hyperparameter tuning using Grid Search CV
    • Train and select the best model
    • Save model using pickle
  5. Model Results:

    • Accuracy around 40%
    • Emphasis on having a working model rather than high accuracy

Step 2: Creating Deployment Setup Using Flask

  1. Creating Virtual Environment:

    • Create project folder and initialize virtual environment (myenv)
    • Activate the virtual environment
  2. Project Files:

    • .gitignore: To exclude myenv
    • Model file: Upload model.pkl (pickle file)
    • app.py: Flask application file for handling requests and loading model
    • index.html: Template file for user interface
  3. Installing Libraries:

    • Required libraries: Flask, numpy, pandas, scikit-learn, gunicorn
    • Create requirements.txt using pip freeze > requirements.txt
  4. Testing Locally:

    • Run python app.py to start Flask server
    • Test application locally by entering student details and predicting placement

Step 3: Uploading to GitHub

  1. GitHub Repository Setup:
    • Create a new repository on GitHub
    • Add repository as remote to the project
    • Push local project files to GitHub

Step 4: Deploying on Render

  1. Render Account Setup:

    • Sign in to Render using GitHub
    • Connect GitHub repository to Render
  2. Deployment Process:

    • Create a new web service on Render
    • Select GitHub repository and configure deployment settings
    • Render will automatically install dependencies and start the server
  3. Final Testing:

    • Access the deployed application via Render-provided URL
    • Test by entering student details and checking placement prediction

Summary and Conclusion

  • Render offers a free and easy-to-use platform for deploying machine learning projects.
  • Suitable for students and hobbyists without budget for paid services.
  • Detailed deployment steps including model preparation, Flask setup, GitHub integration, and Render deployment.
  • Encouragement to explore and utilize Render for personal projects.