client / app.py
Kelas's picture
Update app.py
bd8608d
raw
history blame
4.53 kB
import joblib
import pandas as pd
model = joblib.load('model.joblib')
unique_values = joblib.load('unique_values.joblib')
unique_sex = unique_values["sex"]
unique_country = unique_values["country"]
unique_returning = unique_values["returning"]
unique_GImg1 = unique_values["GImg1"]
unique_GImg2 = unique_values["GImg2"]
unique_GImg3 = unique_values["GImg3"]
unique_PImg1 = unique_values["PImg1"]
unique_PImg2 = unique_values["PImg2"]
unique_PImg3 = unique_values["PImg3"]
unique_PImg4= unique_values["PImg4"]
unique_PImg5 = unique_values["PImg5"]
unique_TAudio1 = unique_values["TAudio1"]
unique_TAudio2 = unique_values["TAudio2"]
unique_TAudio3 = unique_values["TAudio3"]
unique_QAudio1 = unique_values["QAudio1"]
unique_QAudio2 = unique_values["QAudio2"]
unique_QAudio3 = unique_values["QAudio3"]
unique_Proxemics = unique_values["Proxemics"]
def main():
st.title("non-verbal tourist data")
with st.form("questionaire"):
sex = st.selectbox("Sex",options = unique_sex)
age = st.slider("Age",min_value=10,max_values=100)
country = st.selectbox("Country of the client United Nations admitted countries",options = unique_country)
GImg1 = st.selectbox("Handshake Indifferent",options = unique_GImg1)
GImg2 = st.selectbox("Hug Indifferent",options = unique_GImg2)
GImg3 = st.selectbox("Kiss Indifferent",options = unique_GImg3)
PImg1 = st.selectbox("Consent posture Indifferent",options = unique_PImg1)
PImg2 = st.selectbox("Interest posture Indifferent",options = unique_PImg2)
PImg3 = st.selectbox("Neutral posture Indifferent",options = unique_PImg3)
PImg4 = st.selectbox("Reflexive posture Indifferent",options = unique_PImg4)
PImg5 = st.selectbox("Negative posture Indifferent",options = unique_PImg5)
relaxed = st.slider("Observed emotional clime",min_value=1,max_values=10)
Authoritative_anarchic = st.slider("anarchic Observed emotional clime",min_value=1,max_values=10)
Hostile_friendly = st.slider("friendly Observed emotional clime",min_value=1,max_values=10)
TAudio1 = st.selectbox("Authoritative Indifferent",options = unique_TAudio1)
TAudio2 = st.selectbox("Sarcastic Indifferent",options = unique_TAudio2)
TAudio3 = st.selectbox("Friendly Indifferent",options = unique_TAudio3)
QAudio1 = st.selectbox("Spitting Indifferent",options = unique_QAudio1)
QAudio2 = st.selectbox("Hum Indifferent",options = unique_QAudio1)
QAudio3 = st.selectbox("Sigh Indifferent",options = unique_QAudio1)
Proxemics = st.selectbox("Physical distance preferred for the client : A. intimate: 15cm-45cm; B. per-sonal: 46cm-122cm; C. social: 123cm-360cm; D. public: > 360cm",options = unique_Proxemics)
clicked = st.form_submit_button("Predict Type of Client")
if clicked:
result=model.predict(pd.DataFrame({"sex":[sex],
"age": [age],
"country"= [country],
"GImg1" = [GImg1],
"GImg2" = [GImg2],
"GImg3" = [GImg3],
"PImg1" = [PImg1],
"PImg2" = [PImg2],
"PImg3" = [PImg3],
"PImg4" = [PImg4],
"PImg5" = [PImg5],
"Tense-relaxed" = [relaxed],
"Authoritative-anarchic" = [Authoritative_anarchic],
"Hostile-friendly" = [Hostile_friendly],
"TAudio1" =[TAudio1],
"TAudio2" = [TAudio2],
"TAudio3" = [TAudio3],
"QAudio1" = [QAudio1],
"QAudio2" = [QAudio1],
"QAudio3" = [QAudio1],
"Proxemics" = [Proxemics]))
st.success("Predict Type of Client" + result)
if __name__ == "__main__" :
main()