YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
import streamlit as st import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from matplotlib.patches import Ellipse
์น ํ๊ฒฝ์ฉ ํ๊ธ ํฐํธ ์ค์ (ํ๊น ํ์ด์ค ์ ์ฉ)
plt.rc('font', family='DejaVu Sans')
โป ์ค์ ํ๊น ํ์ด์ค ์์ฉ ์๋น์ค ์์๋ Nanum ํฐํธ ์ค์น ์ฝ๋๊ฐ ํ์ํ์ง๋ง,
์์ฐ์ฉ์ผ๋ก๋ ๊ธฐ๋ณธ ํฐํธ๋ก๋ ๊ทธ๋ํ ์์น ํ์ธ์ด ๊ฐ๋ฅํฉ๋๋ค.
st.set_page_config(page_title="๋ ๋ ธํ ์์ธก ์๋ฎฌ๋ ์ดํฐ", layout="wide") st.title("๐ง ๋ ๋ ธํ ๋ฐ ๋ค์ค ์งํ ์์ธก ์๋ฎฌ๋ ์ดํฐ")
st.sidebar.header("ํ์ ์ค์ ") current_age = st.sidebar.number_input("ํ์ฌ ์ฐ๋ น", 40, 90, 60) snp_score = st.sidebar.slider("์ ์ ์ ํ์ฑ๋", 0, 200, 120) target_age = st.sidebar.slider("๋ฏธ๋ ์๋ฎฌ๋ ์ด์ ์ฐ๋ น", current_age, 100, 60)
์์ธก ๋ก์ง
ad_risk = min(99.0, (target_age * 0.6) + (snp_score * 0.15) - 20) pd_risk = min(99.0, 15 + (target_age - 73) * 8.5 + (snp_score * 0.1)) if target_age >= 73 else min(15.0, target_age * 0.1) normal_prob = max(1.0, 100.0 - max(ad_risk, pd_risk))
col1, col2 = st.columns(2)
with col1: st.subheader("๐ ์งํ๋ณ ๋ฐ๋ณ ์ํ๋") df = pd.DataFrame({'์งํ': ['Normal', 'AD', 'PD'], '์ํ๋(%)': [normal_prob, ad_risk, pd_risk]}) fig, ax = plt.subplots() sns.barplot(x='์ํ๋(%)', y='์งํ', data=df, ax=ax, palette='viridis') st.pyplot(fig)
with col2: st.subheader("๐ง ๋ ๋ณ๋ณ ์๋ฎฌ๋ ์ด์ ") fig_brain, ax_brain = plt.subplots() ax_brain.add_patch(Ellipse((5, 5), 8, 6, color='lightgray', alpha=0.5)) # ๋ณ๋ณ ์๊ฐํ (์ํ๋์ ๋ฐ๋ผ ์ปค์ง๋ ์) ax_brain.scatter([6], [6], s=ad_risk20, c='red', alpha=0.5, label='AD Lesion') if target_age >= 73: ax_brain.scatter([4], [4], s=pd_risk30, c='purple', alpha=0.7, label='PD Lesion') ax_brain.set_xlim(0, 10); ax_brain.set_ylim(0, 10); ax_brain.axis('off') st.pyplot(fig_brain)
if target_age >= 73: st.error(f"๐จ {target_age}์ธ ๊ธฐ์ ํํจ์จ ์ํ ๊ธ์ฆ!")