CognitiveScience/Iris-Classifier-Unsupervised
0
1import streamlit as st2import requests as req3from streamlit_lottie import st_lottie4from prediction_helper import predict_class_way1, predict_class_way25 6st.set_page_config(page_title="Welcome to Iris Classifier",page_icon=":blossom:")7 8with st.container():9 st.title("Welcome to Iris Classifier :blossom:")10 11st.write("---")12 13def load_lottieurl(url):14 r=req.get(url)15 if r.status_code !=200:16 None17 return r.json()18 19lottie_flower=load_lottieurl("https://lottie.host/db599348-de9d-44a3-9e66-6490a4920520/jiH4zhQwAD.json")20 21left_col, right_col = st.columns(2)22 23with left_col:24 # Create four input fields.25 sepal_length = st.number_input("Sepal length (cm)", min_value=0.0, max_value=100.0)26 sepal_width = st.number_input("Sepal width (cm)", min_value=0.0, max_value=100.0)27 petal_length = st.number_input("Petal length (cm)", min_value=0.0, max_value=100.0)28 petal_width = st.number_input("Petal width (cm)", min_value=0.0, max_value=100.0)29 30 datapoint = [sepal_length,sepal_width,petal_length,petal_width]31 32 # Display the input fields.33 st.write("Sepal length:", sepal_length)34 st.write("Sepal width:", sepal_width)35 st.write("Petal length:", petal_length)36 st.write("Petal width:", petal_width)37 st.write(" **This model got accuracy of:** ", 0.8933)38 39if(sepal_length!=0 and sepal_width!=0 and petal_length!=0 and petal_width!=0):40 st.write("---")41 result_1=predict_class_way1(datapoint)42 result_2=predict_class_way2(datapoint)43 44 st.write(f" I guess ๐ค it belongs to (using method 1): **{result_1.capitalize()}** ")45 st.write(f" I guess ๐ค it belongs to (using method 2): **{result_2.capitalize()}** ")46 47 if result_1==result_2:48 st.write(" **Hurray :partying_face: we got same results from both techniques!**")49 50with right_col:51 st_lottie(lottie_flower,height=250,key="flower")52 53st.caption("Made with :heart: based on the code [here](https://github.com/Ahmad-Baseer/AI-Projects)")54 55 56#using local css to design contact form57def local_css_for_contact_form(file_name):58 with open(file_name) as f:59 st.markdown(f"<style>{f.read()}</style>",unsafe_allow_html=True)60 61local_css_for_contact_form("style.css")