File size: 4,394 Bytes
931130c
 
b23563c
 
80ffae0
 
b23563c
80ffae0
 
 
b23563c
80ffae0
 
 
b23563c
 
 
 
 
80ffae0
99032ef
 
b23563c
99032ef
 
 
b23563c
163b4b3
 
 
b23563c
163b4b3
b23563c
 
 
163b4b3
b23563c
 
 
163b4b3
b23563c
 
 
163b4b3
b23563c
 
 
163b4b3
80ffae0
 
931130c
95309d0
b23563c
 
 
931130c
 
 
 
be9ce02
931130c
80ffae0
931130c
 
be5c3bf
0a49bb8
 
be5c3bf
931130c
 
 
 
be5c3bf
931130c
95309d0
931130c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95309d0
931130c
 
 
 
 
 
80ffae0
931130c
95309d0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import streamlit as st

# Disease and Treatment Information Data
diseases_info = {
    "flu": {
        "symptoms": ["fever", "cough", "sore throat", "body aches", "fatigue"],
        "treatment": "Rest, fluids, pain relievers, and anti-viral medications if prescribed.",
    },
    "headache": {
        "symptoms": ["head pain", "nausea", "sensitivity to light"],
        "treatment": "Rest, hydration, over-the-counter painkillers, and avoid triggers.",
    },
    "diabetes": {
        "symptoms": ["increased thirst", "frequent urination", "fatigue", "blurred vision"],
        "treatment": "Insulin therapy, lifestyle changes, and dietary management.",
    },
    "cold": {
        "symptoms": ["sore throat", "runny nose", "cough", "sneezing", "mild body aches"],
        "treatment": "Rest, hydration, decongestants, and over-the-counter pain relief.",
    },
    "asthma": {
        "symptoms": ["shortness of breath", "wheezing", "chest tightness", "coughing"],
        "treatment": "Inhalers, bronchodilators, corticosteroids, and avoiding triggers.",
    },
    "pneumonia": {
        "symptoms": ["cough with mucus", "fever", "shortness of breath", "chest pain"],
        "treatment": "Antibiotics for bacterial pneumonia, rest, fluids, and pain relievers.",
    },
    "hypertension": {
        "symptoms": ["headaches", "dizziness", "shortness of breath", "nosebleeds"],
        "treatment": "Medications like beta-blockers, ACE inhibitors, lifestyle changes including exercise and diet.",
    },
    "anxiety": {
        "symptoms": ["excessive worry", "restlessness", "fatigue", "difficulty concentrating", "irritability"],
        "treatment": "Cognitive-behavioral therapy (CBT), medications like SSRIs, relaxation techniques.",
    },
    "depression": {
        "symptoms": ["persistent sadness", "loss of interest", "fatigue", "changes in appetite or sleep patterns"],
        "treatment": "Antidepressants, therapy (CBT), exercise, and social support.",
    },
    "arthritis": {
        "symptoms": ["joint pain", "swelling", "stiffness", "reduced range of motion"],
        "treatment": "Pain relievers, anti-inflammatory drugs, physical therapy, and joint protection.",
    },
    "covid-19": {
        "symptoms": ["fever", "dry cough", "fatigue", "loss of taste or smell", "shortness of breath"],
        "treatment": "Rest, fluids, over-the-counter medications, and antiviral drugs if prescribed.",
    },
}

# Function to display disease info
def display_disease_info(disease_name):
    disease_name = disease_name.lower().replace(" ", "_")
    if disease_name in diseases_info:
        disease = diseases_info[disease_name]
        result = f"\n**Disease:** {disease_name.replace('_', ' ').title()}"
        result += f"\n**Symptoms:** {', '.join(disease['symptoms'])}"
        result += f"\n**Treatment:** {disease['treatment']}"
        return result
    else:
        return "\nSorry, no information available for this disease."

# Function to handle the chat bot
def chat_bot(user_input):
    if 'cha hal aa' in user_input.lower():
        if 'are you healthcare app' in user_input.lower():
        return "na rai mazak na kar maa app"
        return "Khair aa, tu budha!"
    elif 'exit' in user_input.lower():
        return "Goodbye!"
    else:
        return "I'm not sure how to respond to that. Type 'exit' to end the chat."
        def chat_bot(user_input):
# Streamlit App Interface
def main():
    # Title of the app
    st.title("Disease Information and Chat Bot")
    
    # Disease Input
    disease_name = st.text_input("Enter Disease Name", "")
    if disease_name:
        st.subheader("Disease Information")
        disease_info = display_disease_info(disease_name)
        st.text_area("Disease Info", disease_info, height=150)
    
    # Chat Bot Section
    st.subheader("Chat with Bot")
    user_input = st.text_input("Enter a Message (e.g., How are you?)", "")
    if user_input:
        response = chat_bot(user_input)
        st.text_area("Chat Bot Response", response, height=100)
    
    # Add some helpful instructions
    st.markdown("""
        - **Enter a disease name** in the input box to get information about symptoms and treatments.
        - **Ask the chat bot** something like "How are you?" to interact with it.
        - Type "exit" to end the chat session.
    """)

# Run the app
if __name__ == "__main__":
    main()