Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +14 -0
- requirement.txt +1 -0
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
home_input = gr.inputs.Number(label="Number of homes in the city")
|
4 |
+
people_input = gr.inputs.Number(label="Average number of person by home")
|
5 |
+
bus_input = gr.inputs.Number(label="Number of bus in the city")
|
6 |
+
distance_input = gr.inputs.Number(label="Average distance by bus each month")
|
7 |
+
|
8 |
+
|
9 |
+
def my_app(home, people, bus, distance):
|
10 |
+
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"
|
11 |
+
|
12 |
+
|
13 |
+
gr.Interface(fn=my_app, inputs=[
|
14 |
+
home_input, people_input, bus_input, distance_input], outputs=["text", "text", "text"]).launch()
|
requirement.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gradio
|