Hi,
My streamlit running successfully with a blank page except the title.
Please check if there is anything wrong with the code below:
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 27 22:38:42 2022
@author: alishayzadag
"""
import numpy as np
import pickle
import streamlit as st
st.title('Pandas Real Estates')
# Loading the model
loaded_model = pickle.load(open('C:/Users/alishayzadag/Documents/mcs_fyp_2021/streamlit/trained_model2.sav', 'rb'))
# creating the funtion for webapp
def price_pred(input_data):
# input_data = np.array([[-0.43942006, 3.12628155, -1.12165014, -0.27288841, -1.42262747,
# -0.24141041, -1.31238772, 2.61111401, -1.0016859 , -0.5778192 ,
# -0.97491834, 0.41164221, -0.86091034]])
input_data_as = np.array([input_data])
result = loaded_model.predict(input_data_as)
print(result)
return result
def main():
#fetching the data from the user
CRIM = st.text_input('Enter your value')
ZN = st.text_input('Enter your value')
INDUS = st.text_input('Enter your value')
CHAS = st.text_input('Enter your value')
NOX = st.text_input('Enter your value')
RM = st.text_input('Enter your value')
AGE = st.text_input('Enter your value')
DIS = st.text_input('Enter your value')
RAD = st.text_input('Enter your value')
TAX = st.text_input('Enter your value')
PTRATIO = st.text_input('Enter your value')
B = st.text_input('Enter your value')
LSTAT = st.text_input('Enter your value')
# fethcing the result
final_result = ''
if st.button('Calculate'):
final_result = price_pred(CRIM, ZN, INDUS, CHAS, NOX, RM, AGE, DIS, RAD, TAX, PTRATIO, B, LSTAT)
st.success(final_result)
if __name__ == "__main__":
main()