ajeetkumar01 commited on
Commit
7407839
·
verified ·
1 Parent(s): a80906c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Filename: house_price_app.py
2
+
3
+ import gradio as gr
4
+ from sklearn.ensemble import RandomForestRegressor
5
+ import numpy as np
6
+
7
+ # Dummy training
8
+ model = RandomForestRegressor()
9
+ X = np.array([[1000, 2, 10], [1500, 3, 5], [2000, 4, 2]])
10
+ y = np.array([100000, 150000, 200000])
11
+ model.fit(X, y)
12
+
13
+ def predict(area, bedrooms, age):
14
+ price = model.predict([[area, bedrooms, age]])
15
+ return round(price[0], 2)
16
+
17
+ gr.Interface(
18
+ fn=predict,
19
+ inputs=[gr.Number(label="Area (sqft)"),
20
+ gr.Number(label="Bedrooms"),
21
+ gr.Number(label="Age (years)")],
22
+ outputs=gr.Number(label="Predicted Price"),
23
+ title="🏡 House Price Prediction"
24
+ ).launch()