AbdelrahmanRagab's picture
Update app.py
efb0d36 verified
raw
history blame contribute delete
665 Bytes
import gradio as gr
import pickle
# Load the trained model
with open('model.pkl', 'rb') as file:
model = pickle.load(file)
# Define the prediction function
def predict_price(area, bedrooms, bathrooms):
features = [[area, bedrooms, bathrooms]]
prediction = model.predict(features)
return float(prediction[0])
# Create a Gradio interface
interface = gr.Interface(
fn=predict_price,
inputs=["number", "number", "number"],
outputs="number",
title="House Price Predictor",
description="Enter the area (in sqft), number of bedrooms, and number of bathrooms to predict the house price."
)
# Launch the interface
interface.launch()