EswariNani commited on
Commit
f448b74
Β·
verified Β·
1 Parent(s): c7363df

Upload 2 files

Browse files
Files changed (2) hide show
  1. README.md +14 -0
  2. app .py +212 -0
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: AI Health Assistant Basic
3
+ emoji: 🌍
4
+ colorFrom: gray
5
+ colorTo: pink
6
+ sdk: streamlit
7
+ sdk_version: 1.43.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ short_description: Used pretrained models, a basic one
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app .py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''import os
2
+ import subprocess
3
+
4
+ # πŸ”Ή Force install missing dependencies
5
+ missing_packages = ["xgboost"]
6
+ for package in missing_packages:
7
+ try:
8
+ __import__(package)
9
+ except ImportError:
10
+ subprocess.call(["pip", "install", package])
11
+
12
+ from virtualhealth import handle_user_query # Now import your function
13
+ import streamlit as st
14
+
15
+ st.set_page_config(page_title="AI Health Assistant", page_icon="🩺")
16
+
17
+ st.title("🩺 AI Health Assistant")
18
+ st.write("Ask any medical-related questions below:")
19
+
20
+ # User Input
21
+ user_input = st.text_input("Your Question:")
22
+
23
+ # Button to Process Query
24
+ if st.button("Ask"):
25
+ bot_response = handle_user_query(user_input) # Call function directly
26
+ st.markdown(f"**πŸ€– Bot:** {bot_response}")
27
+ '''
28
+ '''import streamlit as st
29
+ from virtualhealth import handle_user_query # Import your function
30
+
31
+ st.set_page_config(page_title="AI Health Assistant", page_icon="🩺")
32
+
33
+ st.title("🩺 AI Health Assistant")
34
+ st.write("Ask any medical-related questions below:")
35
+
36
+ # User Input
37
+ user_input = st.text_input("Your Question:")
38
+
39
+ # Button to Process Query
40
+ if st.button("Ask"):
41
+ bot_response = handle_user_query(user_input) # Call function directly
42
+ st.markdown(f"**πŸ€– Bot:** {bot_response}")
43
+
44
+ # ============================
45
+ # πŸ”Ή Run Test Cases Automatically
46
+ # ============================
47
+ test_cases = [
48
+ "I have fever, chills, and muscle aches",
49
+ "What are the symptoms of pneumonia?",
50
+ "Book an appointment for diabetes",
51
+ "Who should I see for heart attack?",
52
+ "What is the treatment for tuberculosis?",
53
+ "I have nausea, vomiting, and abdominal pain",
54
+ "What are the precautions for malaria?",
55
+ "Who should I see for hepatitis B?",
56
+ "Book an appointment for pneumonia",
57
+ "What is the treatment for migraine?"
58
+ ]
59
+
60
+ st.subheader("πŸ” Sample Test Cases")
61
+ for query in test_cases:
62
+ response = handle_user_query(query)
63
+ st.markdown(f"**πŸ“ Query:** {query}\n**πŸ€– Response:** {response}")'''
64
+ import streamlit as st
65
+ from virtualhealth import handle_user_query # Import your function
66
+
67
+ st.set_page_config(page_title="AI Health Assistant", page_icon="🩺")
68
+
69
+ st.title("🩺 AI Health Assistant")
70
+ st.write("Ask any medical-related questions below:")
71
+
72
+ # User Input
73
+ user_input = st.text_input("Your Question:")
74
+
75
+ # Button to Process Query
76
+ if st.button("Ask"):
77
+ bot_response = handle_user_query(user_input) # Call function directly
78
+ st.markdown(f"**πŸ€– Bot:** {bot_response}")
79
+
80
+ # ============================
81
+ # πŸ”Ή Appointment Booking Section
82
+ # ============================
83
+ st.subheader("πŸ“… Book an Appointment")
84
+
85
+ name = st.text_input("Your Name:")
86
+ contact = st.text_input("Contact Number:")
87
+ appointment_date = st.date_input("Preferred Date:")
88
+ doctor_specialization = st.selectbox("Choose Specialization:", [
89
+ "General Physician", "Cardiologist", "Dermatologist", "Neurologist",
90
+ "Orthopedic", "Pediatrician", "Psychiatrist", "ENT Specialist",
91
+ "Gynecologist", "Oncologist"])
92
+
93
+ if st.button("Book Appointment"):
94
+ if name and contact and appointment_date and doctor_specialization:
95
+ st.success(f"βœ… Appointment booked for {name} with a {doctor_specialization} on {appointment_date}.")
96
+ else:
97
+ st.error("⚠️ Please fill in all the details to book an appointment.")
98
+
99
+ # ============================
100
+ # πŸ”Ή Run 100 Test Cases Automatically
101
+ # ============================
102
+ test_cases = [
103
+ # Fever-related queries
104
+ "What is the treatment for fever?",
105
+ "Give me some home remedies for fever.",
106
+ "Book an appointment for persistent fever.",
107
+ "Who should I consult for high fever?",
108
+ "What precautions should I take for fever?",
109
+ # Body pain-related queries
110
+ "How to treat body pain at home?",
111
+ "Which doctor should I see for severe body pain?",
112
+ "What medicine is good for body pain?",
113
+ "Book an appointment for chronic body pain.",
114
+ "How to prevent muscle pain?",
115
+ # Throat infection-related queries
116
+ "What is the best treatment for a throat infection?",
117
+ "Home remedies for throat infection.",
118
+ "Who should I see for a throat infection?",
119
+ "Book an appointment for a throat infection.",
120
+ "What are the symptoms of a throat infection?",
121
+ # Headache-related queries
122
+ "How to relieve a headache quickly?",
123
+ "Who should I consult for frequent headaches?",
124
+ "Book an appointment for migraines.",
125
+ "What are the causes of severe headaches?",
126
+ "Suggest home remedies for headaches.",
127
+ # Cancer-related queries
128
+ "What are the treatment options for cancer?",
129
+ "Which doctor specializes in cancer treatment?",
130
+ "Book an appointment with an oncologist.",
131
+ "What are the early symptoms of cancer?",
132
+ "How can cancer be prevented?",
133
+ # Additional cases covering different diseases and treatments
134
+ "How is diabetes treated?",
135
+ "Which doctor should I see for diabetes?",
136
+ "Book an appointment for high blood sugar.",
137
+ "What are the precautions for hypertension?",
138
+ "Who should I see for high blood pressure?",
139
+ "What is the best treatment for pneumonia?",
140
+ "How to treat bronchitis at home?",
141
+ "Book an appointment for lung infection.",
142
+ "What are the treatment options for asthma?",
143
+ "Who should I see for breathing difficulties?",
144
+ "How to relieve indigestion?",
145
+ "Who should I consult for stomach pain?",
146
+ "Book an appointment for gastric issues.",
147
+ "What are the symptoms of food poisoning?",
148
+ "How to treat diarrhea at home?",
149
+ "Which doctor should I see for joint pain?",
150
+ "Book an appointment for arthritis treatment.",
151
+ "What are the early signs of osteoporosis?",
152
+ "Suggest treatment for back pain.",
153
+ "How to prevent knee pain?",
154
+ "Who should I see for eye infections?",
155
+ "Book an appointment with an ophthalmologist.",
156
+ "What is the best treatment for pink eye?",
157
+ "How to take care of eye strain?",
158
+ "What are the symptoms of glaucoma?",
159
+ "Who should I consult for ear infections?",
160
+ "Book an appointment with an ENT specialist.",
161
+ "What is the treatment for hearing loss?",
162
+ "How to prevent ear infections?",
163
+ "Suggest treatment for sinusitis.",
164
+ "What are the best remedies for cold and flu?",
165
+ "Who should I see for chronic cough?",
166
+ "Book an appointment for lung problems.",
167
+ "How to boost immunity naturally?",
168
+ "Which doctor should I see for allergies?",
169
+ "Book an appointment with an allergist.",
170
+ "What is the best treatment for skin rash?",
171
+ "Who should I consult for eczema?",
172
+ "How to treat acne effectively?",
173
+ "Book an appointment for skin problems.",
174
+ "What is the best treatment for hair loss?",
175
+ "How to take care of dry skin?",
176
+ "Which doctor should I see for mental health?",
177
+ "Book an appointment with a psychiatrist.",
178
+ "What are the symptoms of depression?",
179
+ "How to treat anxiety naturally?",
180
+ "Who should I see for stress management?",
181
+ "What are the best remedies for insomnia?",
182
+ "How to improve sleep quality?",
183
+ "Who should I consult for weight management?",
184
+ "Book an appointment for obesity treatment.",
185
+ "What is the best diet for heart health?",
186
+ "How to lower cholesterol levels?",
187
+ "What is the treatment for kidney stones?",
188
+ "Who should I see for kidney problems?",
189
+ "Book an appointment with a nephrologist.",
190
+ "How to treat urinary tract infections?",
191
+ "What are the precautions for bladder infections?",
192
+ "Which doctor should I consult for liver problems?",
193
+ "Book an appointment with a hepatologist.",
194
+ "What is the best treatment for hepatitis?",
195
+ "How to prevent fatty liver disease?",
196
+ "Who should I see for digestive disorders?",
197
+ "Book an appointment for a colonoscopy.",
198
+ "What are the best probiotics for gut health?",
199
+ "How to relieve constipation naturally?",
200
+ "Who should I consult for reproductive health?",
201
+ "Book an appointment with a gynecologist.",
202
+ "What is the best treatment for menstrual pain?",
203
+ "How to manage menopause symptoms?",
204
+ "What are the treatment options for infertility?"
205
+ ]
206
+
207
+ st.subheader("πŸ” Sample Test Cases")
208
+ for query in test_cases:
209
+ response = handle_user_query(query)
210
+ st.markdown(f"**πŸ“ Query:** {query}\n**πŸ€– Response:** {response}")
211
+
212
+