Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import matplotlib.pyplot as plt
|
| 5 |
+
|
| 6 |
+
def bmi(name, weight, height):
|
| 7 |
+
bmi_val = weight / (height ** 2)
|
| 8 |
+
return "Hello Mr." + name + ", your BMI is " + str(bmi_val)
|
| 9 |
+
|
| 10 |
+
interface = gr.Interface(bmi,
|
| 11 |
+
inputs = ['text', gr.inputs.Slider(0, 200, label = "Weight in Kg"), gr.inputs.Slider(0, 200, label = "Height in meters")],
|
| 12 |
+
outputs = ['text'],
|
| 13 |
+
description = "This would calculate the BMI",
|
| 14 |
+
examples = [['Abhishek', 100, 200], ['Little', 300, 500], ['Kaushik', 200, 400]],
|
| 15 |
+
theme = "darkgrass",
|
| 16 |
+
title = "BMI Demo"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
interface.launch(auth = ('user', 'password'), auth_message = "Check your email for the login credentials", share = True)
|