File size: 718 Bytes
fe3da6d
 
 
 
b7afdc1
 
fe3da6d
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr

home_input = gr.inputs.Number(label="Number of homes in the city")
people_input = gr.inputs.Number(label="Average number of person by home")
bus_input = gr.inputs.Number(label="Number of buses in the city")
distance_input = gr.inputs.Number(label="Average distance by bus each month (in km)")


def my_app(home, people, bus, distance):
    return "Monthly electrical consumption: " + str(home * 390) + " kWh/mo", "Monthly water consumption: " + str(people * home * 131) + " L/mo", "Monthly CO2 emission: " + str(bus * 36 * distance * 104) + " g/km/mo"


gr.Interface(fn=my_app, inputs=[
             home_input, people_input, bus_input, distance_input], outputs=["text", "text", "text"]).launch()