TPN004 / app.py
Tapanat's picture
Update app.py
6cd12d6
raw
history blame
No virus
942 Bytes
import joblib
import pandas as pd
import streamlit as st
model = joblib.load('model.joblib')
unique_values = joblib.load('unique_values.joblib')
print(unique_values.keys())
unique_Color = list(unique_values["Color"])
def main():
st.title("Colors Prediction")
with st.form("questionaire"):
Color = st.selectbox("Color", unique_Color)
clicked = st.form_submit_button("Predict Color")
if clicked:
result=model.predict(pd.DataFrame({"Color":[Color]}))
predicted_Color = predict_color(result)
st.success('The predicted color is {}'.format(predicted_Color))
def predict_color(prediction):
if prediction == 'Red':
return 'Red'
elif prediction == 'Blue':
return 'Blue'
elif prediction == 'Yellow':
return 'Yellow'
else:
return 'Green'
if __name__=='__main__':
main()