Update app.py
Browse files
app.py
CHANGED
@@ -74,6 +74,37 @@ def get_shap_data(input_text):
|
|
74 |
html_shap_content = shap.plots.text(shap_values, display=False)
|
75 |
return html_shap_content
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
css = """
|
78 |
textarea {
|
79 |
background-color: #00000000;
|
@@ -108,7 +139,29 @@ with gr.Blocks(title="SpecX", css=css, theme=gr.themes.Soft()) as demo:
|
|
108 |
submit_btn_shap.click(get_shap_data, inputs=text_box, outputs=shap_content_box)
|
109 |
with gr.Row():
|
110 |
textmd1 = gr.Markdown('''
|
|
|
111 |
<div style="margin: 50px 0;"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
''')
|
113 |
with gr.Row():
|
114 |
with gr.Column():
|
|
|
74 |
html_shap_content = shap.plots.text(shap_values, display=False)
|
75 |
return html_shap_content
|
76 |
|
77 |
+
all_options = {
|
78 |
+
'Heart hurts': "Immediate medical attention is required. Please seek emergency care.",
|
79 |
+
'Acne': "Consider dermatological treatment options such as topical creams, medications, or lifestyle changes.",
|
80 |
+
'Hair falling out': "Consult a dermatologist to address hair-related concerns.",
|
81 |
+
'Infected wound': "Keep the wound clean and dry. If signs of infection develop, seek immediate medical attention. Consult with a surgeon for evaluation.",
|
82 |
+
'Skin issue': "Seek advice from a dermatologist for personalized treatment options.",
|
83 |
+
'Cough': "Stay hydrated, get plenty of rest, and consider over-the-counter cough medications.",
|
84 |
+
'Ear ache': "Avoid inserting anything into the ear and consult an ENT specialist for proper examination and treatment.",
|
85 |
+
'Feeling cold': "Rest, stay warm, and drink plenty of fluids. Seek medical attention if symptoms worsen.",
|
86 |
+
'Stomach ache': "Avoid spicy or fatty foods, and consider over-the-counter antacids for temporary relief.",
|
87 |
+
'Internal pain': "It's important to get a proper diagnosis. Please consult with a gastroenterologist for further evaluation.",
|
88 |
+
'Open wound': "Keep the wound clean and dry. If signs of infection develop, seek immediate medical attention. Consult with a surgeon for evaluation.",
|
89 |
+
'Feeling dizzy': "Ensure you are well-hydrated and rested. If symptoms persist, consult with a general physician for evaluation.",
|
90 |
+
'Body feels weak': "Get plenty of rest, eat a balanced diet, and consider consulting with a general physician for further evaluation.",
|
91 |
+
'Head ache': "Ensure you are well-hydrated and rested. If headaches persist, consult with a neurologist for evaluation.",
|
92 |
+
'Blurry vision': "Ensure you are well-rested and take regular breaks from screens. If vision problems persist, consult with an ophthalmologist for evaluation.",
|
93 |
+
'Joint pain': "Rest, gentle stretching, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with an orthopedist for evaluation.",
|
94 |
+
'Knee pain': "Rest, gentle stretching, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with an orthopedist for evaluation.",
|
95 |
+
'Back pain': "Rest, gentle stretching, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with an orthopedist for evaluation.",
|
96 |
+
'Emotional pain': "Seek support from friends and family, and consider speaking with a therapist or psychiatrist for evaluation and support.",
|
97 |
+
'Hard to breath': "If experiencing difficulty breathing, seek immediate medical attention. Consult with a respirologist for evaluation.",
|
98 |
+
'Muscle pain': "Rest, gentle exercise, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with a rheumatologist for evaluation.",
|
99 |
+
'Injury from sports': "Rest, gentle exercise, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with a rheumatologist for evaluation.",
|
100 |
+
'Foot ache': "Rest, gentle exercise, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with a rheumatologist for evaluation.",
|
101 |
+
'Shoulder pain': "Rest, gentle stretching, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with a rheumatologist or gastroenterologist for evaluation.",
|
102 |
+
'Neck pain': "Rest, gentle stretching, and over-the-counter pain relievers may provide relief. If symptoms persist, consult with a rheumatologist or orthopedist for evaluation.",
|
103 |
+
}
|
104 |
+
|
105 |
+
def pt_f(x):
|
106 |
+
return all_options.get(x)
|
107 |
+
|
108 |
css = """
|
109 |
textarea {
|
110 |
background-color: #00000000;
|
|
|
139 |
submit_btn_shap.click(get_shap_data, inputs=text_box, outputs=shap_content_box)
|
140 |
with gr.Row():
|
141 |
textmd1 = gr.Markdown('''
|
142 |
+
|
143 |
<div style="margin: 50px 0;"></div>
|
144 |
+
|
145 |
+
''')
|
146 |
+
with gr.Column():
|
147 |
+
textmd1 = gr.Markdown('''
|
148 |
+
## Personalised Treatment
|
149 |
+
''')
|
150 |
+
with gr.Row():
|
151 |
+
with gr.Column():
|
152 |
+
specialist_symptom = gr.Dropdown(
|
153 |
+
label="Select Specialist Type",
|
154 |
+
choices=list(all_options.keys()),
|
155 |
+
)
|
156 |
+
submit_btn2 = gr.Button("Submit", elem_id="warningk", variant='primary')
|
157 |
+
with gr.Column():
|
158 |
+
pt_text = gr.Textbox(label="Recommendation")
|
159 |
+
submit_btn2.click(pt_f, inputs=specialist_symptom, outputs=pt_text)
|
160 |
+
with gr.Row():
|
161 |
+
textmd1 = gr.Markdown('''
|
162 |
+
|
163 |
+
<div style="margin: 50px 0;"></div>
|
164 |
+
|
165 |
''')
|
166 |
with gr.Row():
|
167 |
with gr.Column():
|