roshanalichandio commited on
Commit
828c670
·
1 Parent(s): cb43ef1
Files changed (1) hide show
  1. app.py +72 -0
app.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
10
+ elif land_measurement == "Canals":
11
+ price += 1000 * area
12
+
13
+ # Increase price based on optional facilities
14
+ if garden:
15
+ price += 5000
16
+ if garage:
17
+ price += 4000
18
+ if storage_room:
19
+ price += 3000
20
+ if electricity:
21
+ price += 2000
22
+ if gas:
23
+ price += 3000
24
+ if water:
25
+ price += 2000
26
+ if ac:
27
+ price += 2000
28
+ if geyser:
29
+ price += 1000
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")
38
+ input_doors = gr.inputs.Slider(minimum=0, maximum=20, step=1, default=4, label="Number of Doors")
39
+ input_washrooms = gr.inputs.Slider(minimum=0, maximum=10, step=1, default=2, label="Number of Washrooms")
40
+ input_manzalas = gr.inputs.Slider(minimum=0, maximum=5, step=1, default=1, label="Number of Manzalas")
41
+ input_land_measurement = gr.inputs.Radio(["Marlas", "Canals"], label="Land Measurement")
42
+
43
+ input_garden = gr.inputs.Checkbox(label="Garden")
44
+ input_garage = gr.inputs.Checkbox(label="Garage")
45
+ input_storage_room = gr.inputs.Checkbox(label="Storage Room")
46
+ input_electricity = gr.inputs.Checkbox(label="Electricity")
47
+ input_gas = gr.inputs.Checkbox(label="Gas")
48
+ input_water = gr.inputs.Checkbox(label="Water")
49
+ input_ac = gr.inputs.Checkbox(label="Air Conditioning (AC)")
50
+ input_geyser = gr.inputs.Checkbox(label="Geyser")
51
+ input_roof = gr.inputs.Checkbox(label="Roof")
52
+
53
+ output_price = gr.outputs.Textbox(label="Estimated House Price")
54
+
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."
70
+ )
71
+
72
+ demo.launch()