|
import joblib |
|
import pandas as pd |
|
import streamlit as st |
|
|
|
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 tourists data") |
|
with st.form("questionaire"): |
|
sex = st.selectbox("Sex", options = unique_sex) |
|
age = st.slider("Age", min_value = 20, max_value = 90) |
|
country = st.selectbox("Country of the client United Nations admitted countries", options = unique_country) |
|
returning = st.selectbox(" If the client is returning ", options = unique_returning) |
|
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) |
|
Tense= st.slider("Observed emotional clime", min_value = 1, max_value = 10) |
|
Hostile = st.slider("friendly Observed emotional clime", min_value = 1, max_value = 10) |
|
Authoritative = st.slider("anarchic Observed emotional clime", min_value = 1, max_value = 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", 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], |
|
"returning":[returning], |
|
"GImg1":[GImg1], |
|
"GImg2":[GImg2], |
|
"GImg3":[GImg3], |
|
"PImg1":[PImg1], |
|
"PImg2":[PImg2], |
|
"PImg3":[PImg3], |
|
"PImg4":[PImg4], |
|
"PImg5":[PImg5], |
|
"Tense.relaxed":[Tense], |
|
"Hostile.friendly":[Hostile], |
|
"Authoritative.anarchic":[Authoritative], |
|
"TAudio1":[TAudio1], |
|
"TAudio2":[TAudio2], |
|
"TAudio3":[TAudio3], |
|
"QAudio1":[QAudio1], |
|
"QAudio2":[QAudio1], |
|
"QAudio3":[QAudio1], |
|
"Proxemics":[Proxemics]})) |
|
|
|
result = 'low' if result[0] == 1 else 'high' |
|
st.success("Predict Type of Client is "+result) |
|
|
|
|
|
if __name__ == "__main__": |
|
main() |