Avatansh Malaviya commited on
Commit
333ce44
·
1 Parent(s): 9e44638

Initial BMI Calculator

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def calculate_bmi(weight, height):
4
+ bmi = weight / (height ** 2)
5
+ return f"Your BMI is: {bmi:.2f}"
6
+
7
+ iface = gr.Interface(
8
+ fn=calculate_bmi,
9
+ inputs=[gr.Number(label="Weight (kg)"), gr.Number(label="Height (m)")],
10
+ outputs="text",
11
+ title="BMI Calculator",
12
+ description="Enter your weight in kilograms and height in meters."
13
+ )
14
+
15
+ iface.launch()
16
+ import gradio as gr
17
+
18
+ def calculate_bmi(weight, height):
19
+ bmi = weight / (height ** 2)
20
+ return f"Your BMI is: {bmi:.2f}"
21
+
22
+ iface = gr.Interface(
23
+ fn=calculate_bmi,
24
+ inputs=[gr.Number(label="Weight (kg)"), gr.Number(label="Height (m)")],
25
+ outputs="text",
26
+ title="BMI Calculator",
27
+ description="Enter your weight in kilograms and height in meters."
28
+ )
29
+
30
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio