|
import streamlit as st
|
|
from transformers import pipeline
|
|
|
|
|
|
model_path = "C:\Clinical_Decesion_Support\clinical_decision_support_model"
|
|
classifier = pipeline("text-classification", model=model_path)
|
|
|
|
|
|
st.title("Clinical Decision Support System")
|
|
st.write("Provide patient details to get a medical recommendation.")
|
|
|
|
|
|
age = st.number_input("Age", min_value=0, max_value=120, step=1, value=50)
|
|
gender = st.selectbox("Gender", options=["Male", "Female"])
|
|
weight = st.number_input("Weight (kg)", min_value=0, max_value=300, step=1, value=70)
|
|
smoking_status = st.selectbox("Smoking Status", options=["Never", "Former", "Current"])
|
|
diabetes = st.selectbox("Diabetes", options=["No", "Yes"])
|
|
hypertension = st.selectbox("Hypertension", options=["No", "Yes"])
|
|
cholesterol = st.number_input("Cholesterol (mg/dL)", min_value=0, max_value=500, step=1, value=200)
|
|
heart_disease_history = st.selectbox("Heart Disease History", options=["No", "Yes"])
|
|
symptoms = st.text_input("Symptoms", value="Chest pain")
|
|
risk_score = st.number_input("Risk Score", min_value=0.0, max_value=10.0, step=0.1, value=5.0)
|
|
|
|
|
|
if st.button("Get Recommendation"):
|
|
|
|
input_text = (
|
|
f"Age: {age}, Gender: {gender}, Weight: {weight}, Smoking Status: {smoking_status}, "
|
|
f"Diabetes: {1 if diabetes == 'Yes' else 0}, Hypertension: {1 if hypertension == 'Yes' else 0}, "
|
|
f"Cholesterol: {cholesterol}, Heart Disease History: {1 if heart_disease_history == 'Yes' else 0}, "
|
|
f"Symptoms: {symptoms}, Risk Score: {risk_score}"
|
|
)
|
|
|
|
|
|
prediction = classifier(input_text)
|
|
recommendation_label = prediction[0]['label']
|
|
|
|
|
|
reverse_label_mapping = {
|
|
"LABEL_0": "Maintain healthy lifestyle",
|
|
"LABEL_1": "Immediate cardiologist consultation",
|
|
"LABEL_2": "Start statins, monitor regularly",
|
|
"LABEL_3": "Lifestyle changes, monitor",
|
|
"LABEL_4": "No immediate action",
|
|
"LABEL_5": "Increase statins, lifestyle changes",
|
|
"LABEL_6": "Start ACE inhibitors, monitor"
|
|
}
|
|
recommendation = reverse_label_mapping.get(recommendation_label, "Unknown Recommendation")
|
|
|
|
|
|
st.subheader("Recommendation")
|
|
st.write(recommendation)
|
|
|