Spaces:
Sleeping
Sleeping
Commit
·
6efb513
1
Parent(s):
1769095
app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def house_price_estimation(area, rooms, kitchens, doors, washrooms, manzalas, land_measurement, garden=False, garage=False, storage_room=False, electricity=False, gas=False, water=False, ac=False, geyser=False, roof=False):
|
4 |
# Perform calculations to estimate the house price based on the provided details
|
5 |
price = area * 100 + rooms * 2000 + kitchens * 1500
|
6 |
-
|
7 |
# Increase price based on land measurement
|
8 |
if land_measurement == "Marlas":
|
9 |
price += 500 * area
|
@@ -30,8 +30,17 @@ def house_price_estimation(area, rooms, kitchens, doors, washrooms, manzalas, la
|
|
30 |
if roof:
|
31 |
price += 2000
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
return price
|
34 |
|
|
|
35 |
input_area = gr.inputs.Slider(minimum=0, maximum=5000, step=100, default=1000, label="Area (in square feet)")
|
36 |
input_rooms = gr.inputs.Slider(minimum=0, maximum=10, step=1, default=3, label="Number of Rooms")
|
37 |
input_kitchens = gr.inputs.Slider(minimum=0, maximum=5, step=1, default=1, label="Number of Kitchens")
|
@@ -55,15 +64,15 @@ output_price = gr.outputs.Textbox(label="Estimated House Price")
|
|
55 |
demo = gr.Interface(
|
56 |
fn=house_price_estimation,
|
57 |
inputs=[
|
58 |
-
input_area, input_rooms, input_kitchens, input_doors, input_washrooms, input_manzalas,
|
59 |
input_land_measurement, input_garden, input_garage, input_storage_room,
|
60 |
input_electricity, input_gas, input_water, input_ac, input_geyser, input_roof
|
61 |
],
|
62 |
outputs=output_price,
|
63 |
examples=[
|
64 |
-
[1000, 3, 1, 4, 2, 1, "Marlas", True, False, True, True, False, True, False, False, True],
|
65 |
-
[1500, 4, 2, 6, 3, 1, "Canals", False, True, False, False, True, True, False, False, True],
|
66 |
-
[800, 2, 1, 2, 1, 1, "Marlas", True, False, False, True, True, True, False, True, False]
|
67 |
],
|
68 |
title="House Price Estimation",
|
69 |
description="Estimate the price of a house based on the provided requirements."
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def house_price_estimation(city, area, rooms, kitchens, doors, washrooms, manzalas, land_measurement, garden=False, garage=False, storage_room=False, electricity=False, gas=False, water=False, ac=False, geyser=False, roof=False):
|
4 |
# Perform calculations to estimate the house price based on the provided details
|
5 |
price = area * 100 + rooms * 2000 + kitchens * 1500
|
6 |
+
|
7 |
# Increase price based on land measurement
|
8 |
if land_measurement == "Marlas":
|
9 |
price += 500 * area
|
|
|
30 |
if roof:
|
31 |
price += 2000
|
32 |
|
33 |
+
# Adjust price based on city
|
34 |
+
if city == "Islamabad":
|
35 |
+
price += 5000
|
36 |
+
elif city == "Karachi":
|
37 |
+
price += 3000
|
38 |
+
elif city == "Lahore":
|
39 |
+
price += 2000
|
40 |
+
|
41 |
return price
|
42 |
|
43 |
+
input_city = gr.inputs.Dropdown(["Islamabad", "Karachi", "Lahore"], label="City")
|
44 |
input_area = gr.inputs.Slider(minimum=0, maximum=5000, step=100, default=1000, label="Area (in square feet)")
|
45 |
input_rooms = gr.inputs.Slider(minimum=0, maximum=10, step=1, default=3, label="Number of Rooms")
|
46 |
input_kitchens = gr.inputs.Slider(minimum=0, maximum=5, step=1, default=1, label="Number of Kitchens")
|
|
|
64 |
demo = gr.Interface(
|
65 |
fn=house_price_estimation,
|
66 |
inputs=[
|
67 |
+
input_city, input_area, input_rooms, input_kitchens, input_doors, input_washrooms, input_manzalas,
|
68 |
input_land_measurement, input_garden, input_garage, input_storage_room,
|
69 |
input_electricity, input_gas, input_water, input_ac, input_geyser, input_roof
|
70 |
],
|
71 |
outputs=output_price,
|
72 |
examples=[
|
73 |
+
["Islamabad", 1000, 3, 1, 4, 2, 1, "Marlas", True, False, True, True, False, True, False, False, True],
|
74 |
+
["Karachi", 1500, 4, 2, 6, 3, 1, "Canals", False, True, False, False, True, True, False, False, True],
|
75 |
+
["Lahore", 800, 2, 1, 2, 1, 1, "Marlas", True, False, False, True, True, True, False, True, False]
|
76 |
],
|
77 |
title="House Price Estimation",
|
78 |
description="Estimate the price of a house based on the provided requirements."
|