Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +53 -0
- requirements.txt +4 -0
- thyroid_cancer_model.pkl +3 -0
app.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import joblib
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
# Modeli yükle
|
6 |
+
model = joblib.load('thyroid_cancer_model.pkl')
|
7 |
+
|
8 |
+
# Uygulama başlığı
|
9 |
+
st.title('Thyroid Cancer Recurrence Prediction')
|
10 |
+
|
11 |
+
# Giriş verilerini al
|
12 |
+
age = st.number_input('Age', min_value=0, max_value=100, step=1)
|
13 |
+
gender = st.selectbox('Gender', ['M', 'F'])
|
14 |
+
smoking = st.selectbox('Smoking', ['Yes', 'No'])
|
15 |
+
hx_smoking = st.selectbox('Hx Smoking', ['Yes', 'No'])
|
16 |
+
hx_radiotherapy = st.selectbox('Hx Radiotherapy', ['Yes', 'No'])
|
17 |
+
thyroid_function = st.selectbox('Thyroid Function', ['Euthyroid', 'Clinical Hyperthyroidism', 'Subclinical Hyperthyroidism'])
|
18 |
+
physical_examination = st.selectbox('Physical Examination', ['Single nodular goiter-left', 'Multinodular goiter', 'Single nodular goiter-right'])
|
19 |
+
adenopathy = st.selectbox('Adenopathy', ['No', 'Right', 'Left', 'Bilateral', 'Extensive'])
|
20 |
+
pathology = st.selectbox('Pathology', ['Micropapillary', 'Papillary', 'Follicular', 'Hurthel cell'])
|
21 |
+
focality = st.selectbox('Focality', ['Uni-Focal', 'Multi-Focal'])
|
22 |
+
risk = st.selectbox('Risk', ['Low', 'Intermediate', 'High'])
|
23 |
+
t = st.selectbox('T', ['T1a', 'T1b', 'T2', 'T3', 'T4a', 'T4b'])
|
24 |
+
n = st.selectbox('N', ['N0', 'N1a', 'N1b'])
|
25 |
+
m = st.selectbox('M', ['M0', 'M1'])
|
26 |
+
stage = st.selectbox('Stage', ['I', 'II', 'III', 'IVA', 'IVB'])
|
27 |
+
response = st.selectbox('Response', ['Excellent', 'Indeterminate', 'Biochemical Incomplete', 'Structural Incomplete'])
|
28 |
+
|
29 |
+
# Giriş verilerini bir dataframe'e dönüştür
|
30 |
+
input_data = pd.DataFrame({
|
31 |
+
'Age': [age],
|
32 |
+
'Gender': [gender],
|
33 |
+
'Smoking': [smoking],
|
34 |
+
'Hx Smoking': [hx_smoking],
|
35 |
+
'Hx Radiothreapy': [hx_radiotherapy],
|
36 |
+
'Thyroid Function': [thyroid_function],
|
37 |
+
'Physical Examination': [physical_examination],
|
38 |
+
'Adenopathy': [adenopathy],
|
39 |
+
'Pathology': [pathology],
|
40 |
+
'Focality': [focality],
|
41 |
+
'Risk': [risk],
|
42 |
+
'T': [t],
|
43 |
+
'N': [n],
|
44 |
+
'M': [m],
|
45 |
+
'Stage': [stage],
|
46 |
+
'Response': [response]
|
47 |
+
})
|
48 |
+
|
49 |
+
# Tahmin yap butonu
|
50 |
+
if st.button('Predict Recurrence'):
|
51 |
+
prediction = model.predict(input_data)
|
52 |
+
result = 'likely to recur' if prediction[0] == 1 else 'not likely to recur'
|
53 |
+
st.write(f'The model predicts that the cancer is {result}.')
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
joblib
|
3 |
+
scikit-learn
|
4 |
+
pandas
|
thyroid_cancer_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fc40b8b8cb4350f247eb66ac812dba01ed162d9019c2fee420c9b0ec4c182af0
|
3 |
+
size 9150
|