Spaces:
Runtime error
Runtime error
import joblib | |
import pandas as pd | |
import streamlit as st | |
model = joblib.load('model.joblib') | |
unique_values = joblib.load('unique_values.joblib') | |
def main(): | |
st.title("House price Paris") | |
with st.form("questionaire"): | |
numberOfRooms = st.slider("Number of Bedrooms", 0, 100, 1) | |
hasPool = st.slider("Has pool", 0, 1 ,1) | |
hasYard = st.slider("Has yard", 0, 1, 1) | |
squareMeters = st.slider("Square", 0, 100000, 1) | |
hasGuestRoom = st.slider("Number of Guest room", 0, 10, 1) | |
numPrevOwners = st.slider("Prev-Owners", 0, 10, 1) | |
# clicked==True only when the button is clicked | |
clicked = st.form_submit_button("Predict price") | |
if clicked: | |
result=model.predict(pd.DataFrame({"numberOfRooms": [numberOfRooms], | |
"hasPool": [hasPool], | |
"hasYard": [hasYard], | |
"squareMeters": [squareMeters], | |
"hasGuestRoom": [hasGuestRoom], | |
"numPrevOwners": [numPrevOwners]})) | |
# Show prediction | |
st.success(f"The house price prediction is {result}$") | |
if __name__ == "__main__": | |
main() | |