import streamlit as st import joblib import pandas as pd # Modeli yükle model = joblib.load('thyroid_cancer_model.pkl') # Uygulama başlığı st.title('Thyroid Cancer Recurrence Prediction') # Giriş verilerini al age = st.number_input('Age', min_value=0, max_value=100, step=1) gender = st.selectbox('Gender', ['M', 'F']) smoking = st.selectbox('Smoking', ['Yes', 'No']) hx_smoking = st.selectbox('Hx Smoking', ['Yes', 'No']) hx_radiotherapy = st.selectbox('Hx Radiotherapy', ['Yes', 'No']) thyroid_function = st.selectbox('Thyroid Function', ['Euthyroid', 'Clinical Hyperthyroidism', 'Subclinical Hyperthyroidism']) physical_examination = st.selectbox('Physical Examination', ['Single nodular goiter-left', 'Multinodular goiter', 'Single nodular goiter-right']) adenopathy = st.selectbox('Adenopathy', ['No', 'Right', 'Left', 'Bilateral', 'Extensive']) pathology = st.selectbox('Pathology', ['Micropapillary', 'Papillary', 'Follicular', 'Hurthel cell']) focality = st.selectbox('Focality', ['Uni-Focal', 'Multi-Focal']) risk = st.selectbox('Risk', ['Low', 'Intermediate', 'High']) t = st.selectbox('T', ['T1a', 'T1b', 'T2', 'T3', 'T4a', 'T4b']) n = st.selectbox('N', ['N0', 'N1a', 'N1b']) m = st.selectbox('M', ['M0', 'M1']) stage = st.selectbox('Stage', ['I', 'II', 'III', 'IVA', 'IVB']) response = st.selectbox('Response', ['Excellent', 'Indeterminate', 'Biochemical Incomplete', 'Structural Incomplete']) # Giriş verilerini bir dataframe'e dönüştür input_data = pd.DataFrame({ 'Age': [age], 'Gender': [gender], 'Smoking': [smoking], 'Hx Smoking': [hx_smoking], 'Hx Radiothreapy': [hx_radiotherapy], 'Thyroid Function': [thyroid_function], 'Physical Examination': [physical_examination], 'Adenopathy': [adenopathy], 'Pathology': [pathology], 'Focality': [focality], 'Risk': [risk], 'T': [t], 'N': [n], 'M': [m], 'Stage': [stage], 'Response': [response] }) # Tahmin yap butonu if st.button('Predict Recurrence'): prediction = model.predict(input_data) result = 'likely to recur' if prediction[0] == 1 else 'not likely to recur' st.write(f'The model predicts that the cancer is {result}.')