hp / app.py
ajeetkumar01's picture
Create app.py
7407839 verified
raw
history blame contribute delete
661 Bytes
# Filename: house_price_app.py
import gradio as gr
from sklearn.ensemble import RandomForestRegressor
import numpy as np
# Dummy training
model = RandomForestRegressor()
X = np.array([[1000, 2, 10], [1500, 3, 5], [2000, 4, 2]])
y = np.array([100000, 150000, 200000])
model.fit(X, y)
def predict(area, bedrooms, age):
price = model.predict([[area, bedrooms, age]])
return round(price[0], 2)
gr.Interface(
fn=predict,
inputs=[gr.Number(label="Area (sqft)"),
gr.Number(label="Bedrooms"),
gr.Number(label="Age (years)")],
outputs=gr.Number(label="Predicted Price"),
title="🏡 House Price Prediction"
).launch()