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