How To Make a BMI Calculator Web Application

So Today we will be creating a good-looking BMI Calculator Web application. Before diving into this mini-project, We must know what is BMI.

What is BMI ?

Body Mass Index (BMI) is a person’s weight in kilograms divided by the square of height in meters. A high BMI can indicate high body fatness. BMI screens for weight categories that may lead to health problems, but it does not diagnose the body fatness or health of an individual.

Formulae to calculate BMI

BMI = Weight(kgs)/Height(metres) ²

How to know Status of Your Health ?

You are Underweight if your BMI is equal to or less than 18.5.

You are Normal Weight if your BMI lies within 18.5 to 24.9.

You are Over Weight if your BMI lies with 25 to 29.9

You are Obese if your BMI is greater than 29.9

Start Project

To Create a Web application, I will be using one of the awesome python framework Streamlit. So let’s start with this mini – project.

Step 1 – Install Streamlit

Go to Terminal and type

pip install streamlit

Now, You are good to go.

Import streamlit

To use Streamlit, First thing you need to do is import it.

import streamlit as st

We will be using title function of streamlit to add the title of web application.

st.title('BMI Calculator')

Let’s Run our Web – application

To run a Web application, go to your terminal and type the following.

streamlit run filename.py

Asking User for Height and Weight :

To take values in number from user , we will simply use number input method of streamlit.

To Calculate BMI :

Formulae to Calculate BMI is : weight/height/height*10000

bmi = round(height/weight/weight*10000,2)

Finalizing this mini project by checking BMI

Now to Check BMI , We will Compare bmi with formulae Criteria :

import streamlit as st

st.title('BMI Calculator')

check = st.button('Find BMI')
if(check):
bmi = round(weight/height/height*10000,2)