MLZia_LR / hh.py
roshanalichandio's picture
app.py
bb60174
raw
history blame
3.06 kB
pip install -q gradio nltk
import gradio as gr
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):
# Perform calculations to estimate the house price based on the provided details
price = area * 100 + rooms * 2000 + kitchens * 1500
# Increase price based on land measurement
if land_measurement == "Marlas":
price += 500 * area
elif land_measurement == "Canals":
price += 1000 * area
# Increase price based on optional facilities
if garden:
price += 5000
if garage:
price += 4000
if storage_room:
price += 3000
if electricity:
price += 2000
if gas:
price += 3000
if water:
price += 2000
if ac:
price += 2000
if geyser:
price += 1000
if roof:
price += 2000
return price
input_area = gr.inputs.Slider(minimum=0, maximum=5000, step=100, default=1000, label="Area (in square feet)")
input_rooms = gr.inputs.Slider(minimum=0, maximum=10, step=1, default=3, label="Number of Rooms")
input_kitchens = gr.inputs.Slider(minimum=0, maximum=5, step=1, default=1, label="Number of Kitchens")
input_doors = gr.inputs.Slider(minimum=0, maximum=20, step=1, default=4, label="Number of Doors")
input_washrooms = gr.inputs.Slider(minimum=0, maximum=10, step=1, default=2, label="Number of Washrooms")
input_manzalas = gr.inputs.Slider(minimum=0, maximum=5, step=1, default=1, label="Number of Manzalas")
input_land_measurement = gr.inputs.Radio(["Marlas", "Canals"], label="Land Measurement")
input_garden = gr.inputs.Checkbox(label="Garden")
input_garage = gr.inputs.Checkbox(label="Garage")
input_storage_room = gr.inputs.Checkbox(label="Storage Room")
input_electricity = gr.inputs.Checkbox(label="Electricity")
input_gas = gr.inputs.Checkbox(label="Gas")
input_water = gr.inputs.Checkbox(label="Water")
input_ac = gr.inputs.Checkbox(label="Air Conditioning (AC)")
input_geyser = gr.inputs.Checkbox(label="Geyser")
input_roof = gr.inputs.Checkbox(label="Roof")
output_price = gr.outputs.Textbox(label="Estimated House Price")
demo = gr.Interface(
fn=house_price_estimation,
inputs=[
input_area, input_rooms, input_kitchens, input_doors, input_washrooms, input_manzalas,
input_land_measurement, input_garden, input_garage, input_storage_room,
input_electricity, input_gas, input_water, input_ac, input_geyser, input_roof
],
outputs=output_price,
examples=[
[1000, 3, 1, 4, 2, 1, "Marlas", True, False, True, True, False, True, False, False, True],
[1500, 4, 2, 6, 3, 1, "Canals", False, True, False, False, True, True, False, False, True],
[800, 2, 1, 2, 1, 1, "Marlas", True, False, False, True, True, True, False, True, False]
],
title="House Price Estimation",
description="Estimate the price of a house based on the provided requirements."
)
demo.launch()