import gradio as gr def calculate_bmi(Name,height_cm, weight_kg): height_cm = height_cm / 100 # Convert height from cm to meters bmi = weight_kg / (height_cm ** 2) # Calculate BMI # Categorize BMI if bmi < 18.5: category = "Underweight " emoji = "😢" elif bmi >= 18.5 and bmi <= 24.9: category = "Normal weight" emoji = "😊" elif bmi >= 25 and bmi <= 29.9: category = "Overweight" emoji = "😕" else: category = "Obesity" emoji = "-😱-" return f"Name : {Name}\n\nYour BMI: {bmi:.2f}\nCategory: {category} {emoji} " bmi = gr.Interface(fn=calculate_bmi, inputs=['text', gr.Slider(0, 220, label="Height in cm"), gr.Slider(0, 130, label="Weight in kg")], outputs="text", title="BMI Calculator in Metrics", description="Calculate your BMI (Body Mass Index) based on height **(cm)** and weight **(kg)**.\n\nDeveloped by: Parthebhan Pari \n\n**BMI Categories:**\n- Underweight = <18.5\n- Normal weight = 18.5–24.9\n- Overweight = 25–29.9\n- Obesity = BMI of 30 or greater", ) bmi.launch()