Spaces:
Sleeping
Sleeping
File size: 2,113 Bytes
b0b3c12 cdd107b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
def calculate_bmi(weight, height,age,gender):
height_m = height / 100
bmi = weight / (height_m ** 2)
if bmi < 18.5:
category = "Underweight π"
elif 18.5 <= bmi < 24.9:
category = "Normal weight π"
elif 25 <= bmi < 29.9:
category = "Overweight π"
else:
category = "Obesity π"
return f"BMI: {bmi:.2f} - {category}"
import gradio as gr
interface = gr.Interface(
fn=calculate_bmi,
inputs=[
gr.Slider(0, 120, step=1, label="Weight (kg)"),
gr.Slider(100, 250, step=1, label="Height (cm)"),
gr.Slider(5, 100, step=1, label="AGE(years)"),
gr.Radio(["Male", "Female"], label="Gender")
],
outputs="text",
title="BMI CALCULATOR",
description="Adjust your weight and height to calculate your BMI.",
flagging_dir="flagged_data",
examples=[[12,23,3,"Male"],
[32,44,2,"Female"]],
live=True , ## to eleminate the submitt button
flagging_options=["good", "bad", "average"],## option for flag to users
theme="Citrus",
css = """
body, .container, .block, .output, .input, .slider, .btn-primary, .btn-secondary, .label {
background-color: #1E1E1E !important; /* Dark background color */
color: #F5F5F5 !important; /* Light text color */
border-color: #333333 !important; /* Darker border color */
}
.slider input[type="range"] {
background: linear-gradient(to right, #FF5722, #FFEB3B) !important; /* Gradient for slider */
}
.btn-primary {
background-color: #4CAF50 !important; /* Green for primary button */
color: #FFFFFF !important;
}
.btn-secondary {
background-color: #FF5722 !important; /* Orange for secondary button */
color: #FFFFFF !important;
}
.label {
font-weight: bold;
color: #A0A0A0 !important; /* Softer light color for labels */
}
"""
)
interface.launch(share=True,debug=True)
|