import gradio as gr def calculate_bmi(weight, height): bmi = weight / (height ** 2) if bmi < 18.5: return f"Your BMI is {bmi:.2f}. You are underweight." elif 18.5 <= bmi < 24.9: return f"Your BMI is {bmi:.2f}. You have a normal weight." else: return f"Your BMI is {bmi:.2f}. You are overweight." # Create the Gradio interface with a title and custom layout interface = gr.Interface( fn=calculate_bmi, inputs=["number", "number"], outputs="text", title="BMI Calculator", description="Enter your weight and height to calculate your Body Mass Index (BMI).", live=True ) # Launch the interface interface.launch()