Download app.py from ai-26/README: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/ai-26/README/resolve/main/app.py
- Command line
-
hf download hf://spaces/ai-26/README/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ai-26/README/resolve/main/app.py
1.99 kB
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| import warnings | |
| # Suppress warnings | |
| warnings.filterwarnings("ignore") | |
| # Title and objective | |
| st.title("Heart Disease UCI") | |
| st.markdown(""" | |
| #### Objective: | |
| To develop a method for predicting the risk of heart disease in individuals by examining a range of physical characteristics, such as age, weight, and blood pressure, as well as analyzing various blood values, including cholesterol levels, blood sugar, and other relevant biomarkers. This approach aims to identify patterns and risk factors that are associated with the development of heart disease, allowing for early detection and intervention to improve overall health outcomes. | |
| """) | |
| st.image('https://kardiocentar.ba/wp-content/uploads/2019/04/3-infarkt.jpg') | |
| # Load the dataset | |
| df = pd.read_csv("heart_disease_uci.csv") | |
| # Display the first few rows of the dataset | |
| st.subheader("EDA") | |
| st.code("df.head()") | |
| st.write(df.head()) | |
| st.code("df.tail()") | |
| st.write(df.tail()) | |
| st.code("df.describe()") | |
| st.write(df.describe()) | |
| # Display dataset information | |
| st.subheader("Dataset Information") | |
| st.code("df.info()") | |
| buffer = pd.DataFrame({"Data Types": df.dtypes, "Non-Null Count": df.notnull().sum()}) | |
| st.write(buffer) | |
| # Display statistical summary | |
| st.subheader("Statistical Summary") | |
| st.write(df.describe()) | |
| # Exploratory Data Analysis (EDA) | |
| st.subheader("Exploratory Data Analysis") | |
| # Plotting: example histogram of age | |
| st.subheader("Age Distribution") | |
| fig, ax = plt.subplots() | |
| sns.histplot(df['age'], bins=30, kde=True, ax=ax) | |
| st.pyplot(fig) | |
| # Additional visualizations can be added here | |
| # Statistical review | |
| st.subheader("Statistical Review") | |
| float_columns = df.select_dtypes(include=[np.float64]).columns | |
| st.write(float_columns) | |
| # More analysis and visualizations can be added here | |
| if __name__ == "__main__": | |
| st.write("Heart Disease UCI is running!") |