engi-tech / app.py
n0no123's picture
Upload app.py
20c7944
raw
history blame
936 Bytes
# nb de foyers dans la ville * 390 (kWh) = month consommation
# nb moyen de personnes par foyer * nb de foyers * 131 (L) = water consumption
# 36 (places bus) * 104 (g/km) * moyenne des distances parcourues par des bus.
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 bus in the city")
distance_input = gr.inputs.Number(label="Average distance by bus each month")
def my_app(home, people, bus, distance):
return "Monthly electrical consumption: " + str(home * 390) + "kWh/month", "Monthly water consumption: " + str(people * home * 131) + "L/month", "Monthly CO2 emission: " + str(bus * 36 * distance * 104) + "g/km/month"
gr.Interface(fn=my_app, inputs=[
home_input, people_input, bus_input, distance_input], outputs=["text", "text", "text"]).launch()