Spaces:
Sleeping
Sleeping
#%% | |
import gradio as gr | |
import joblib | |
import pandas as pd | |
import numpy as np | |
# Load trained model | |
model = joblib.load("best_model.pkl") | |
# Prediction function | |
def predict_price(rooms, area, distance_to_center_km): | |
return model.predict([[rooms, area, distance_to_center_km]])[0] | |
# Create Gradio app | |
iface = gr.Interface( | |
fn=predict_price, | |
inputs=["number", "number", "number"], # Four number inputs | |
outputs="number", # Output as a number | |
# examples=[[4.5, 120, "Dietlikon"], [3.5, 60, "Winterthur"]] # Examples for the inputs | |
) | |
# Launch the app | |
iface.launch() |