Spaces:
Runtime error
Runtime error
| 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() | |