import streamlit as st import pandas as pd import numpy as np import pickle import base64 import seaborn as sns import matplotlib.pyplot as plt st.set_page_config( page_title="Autism App" ) st.title('Autism Screening on Adults') st.write(""" ## Abstract Improve Autism Screening by creating predicting the likelihood of having this condition. ## What is Autism Autism, or autism spectrum disorder (ASD), refers to a broad range of conditions characterized by challenges with social skills, repetitive behaviors, speech and nonverbal communication. ## Causes and Challenges It is mostly influenced by a combination of genetic and environmental factors. Because autism is a spectrum disorder, each person with autism has a distinct set of strengths and challenges. The ways in which people with autism learn, think and problem-solve can range from highly skilled to severely challenged. Research has made clear that high quality early intervention can improve learning, communication and social skills, as well as underlying brain development. Yet the diagnostic process can take several years. ## The Role of Machine Learning This dataset is composed of survey results for more than 700 people who filled an app form. There are labels portraying whether the person received a diagnosis of autism, allowing machine learning models to predict the likelihood of having autism, therefore allowing healthcare professionals prioritize their resources. ## How to use Predict the likelihood of a person having autism using survey and demographic variables. Explore Autism across Gender, Age, and other variables """) url_dataset = f'Download Dataset CSV File' st.markdown(url_dataset, unsafe_allow_html=True) def user_input_features() : a1_score = st.sidebar.slider('A1_Score', 0.00, 1.00) a2_score = st.sidebar.slider('A2_Score', 0.00, 1.00) a3_score = st.sidebar.slider('A3_Score', 0.00, 1.00) a4_score = st.sidebar.slider('A4_Score', 0.00, 1.00) a5_score = st.sidebar.slider('A5_Score', 0.00, 1.00) a6_score = st.sidebar.slider('A6_Score', 0.00, 1.00) a7_score = st.sidebar.slider('A7_Score', 0.00, 1.00) a8_score = st.sidebar.slider('A8_Score', 0.00, 1.00) a9_score = st.sidebar.slider('A9_Score', 0.00, 1.00) a10_score = st.sidebar.slider('A10_Score', 0.00, 1.00) data = {'a1_score':[a1_score], 'a2_score':[a2_score], 'a3_score':[a3_score], 'a4_score':[a4_score], 'a5_score':[a5_score], 'a6_score':[a6_score], 'a7_score':[a7_score], 'a8_score':[a8_score], 'a9_score':[a9_score], 'a10_score':[a10_score] } features = pd.DataFrame(data) return features input_df = user_input_features() df_autism = pd.read_csv('autism_screening.csv') df_autism = df_autism[['A1_Score', 'A2_Score', 'A3_Score', 'A4_Score', 'A5_Score', 'A6_Score', 'A7_Score', 'A8_Score', 'A9_Score', 'A10_Score', 'age', 'gender', 'ethnicity', 'jundice', 'austim', 'contry_of_res', 'used_app_before', 'result', 'age_desc', 'relation', 'Class/ASD']].copy() df_autism = df_autism.dropna() df_autism['gender'] = np.where(df_autism['gender']=='m', 1, 0) df_autism['jundice'] = np.where(df_autism['jundice']=='yes', 1, 0) df_autism['austim'] = np.where(df_autism['austim']=='yes', 1, 0) df_autism['Class/ASD'] = np.where(df_autism['Class/ASD']=='YES', 1, 0) df = df_autism.drop(['ethnicity', 'contry_of_res', 'used_app_before', 'result', 'age_desc', 'relation'], axis=1) df.fillna(0, inplace=True) df = df.drop(columns=['Class/ASD']) df = pd.concat([input_df, df], axis=1) df = df[:1] # Selects only the first row (the user input data) df.fillna(0, inplace=True) features = ['a1_score', 'a2_score', 'a3_score', 'a4_score', 'a5_score', 'a6_score', 'a7_score', 'a8_score', 'a9_score', 'a10_score', 'age', 'gender', 'jundice', 'austim' ] df = df[features] st.subheader('User Input features') st.write(df) load_clf = pickle.load(open('autism_clf.pkl', 'rb')) prediction = load_clf.predict(df) prediction_proba = load_clf.predict_proba(df) autism_labels = np.array(['No','Yes']) st.subheader('Prediction') st.write(autism_labels[prediction]) st.subheader('Prediction Probability') st.write(prediction_proba)