Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -52,14 +52,21 @@ health_knowledge_base = {
|
|
52 |
def get_health_info(query):
|
53 |
query = query.lower()
|
54 |
|
|
|
|
|
|
|
55 |
# Search for conditions that match the query
|
56 |
for condition, info in health_knowledge_base.items():
|
57 |
-
if condition in query:
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
|
64 |
# Set up the Streamlit app interface
|
65 |
st.title("Healthcare Knowledge Chatbot")
|
|
|
52 |
def get_health_info(query):
|
53 |
query = query.lower()
|
54 |
|
55 |
+
# List to store matching results
|
56 |
+
matching_conditions = []
|
57 |
+
|
58 |
# Search for conditions that match the query
|
59 |
for condition, info in health_knowledge_base.items():
|
60 |
+
if condition in query or any(symptom in query for symptom in info['symptoms']):
|
61 |
+
matching_conditions.append(f"Condition: {condition.title()}\n"
|
62 |
+
f"Symptoms: {', '.join(info['symptoms'])}\n"
|
63 |
+
f"Treatment: {info['treatment']}\n")
|
64 |
|
65 |
+
# If we have matching conditions, return all of them, otherwise return a message
|
66 |
+
if matching_conditions:
|
67 |
+
return "\n\n".join(matching_conditions)
|
68 |
+
else:
|
69 |
+
return "Sorry, I couldn't find information on that condition. Please try another query."
|
70 |
|
71 |
# Set up the Streamlit app interface
|
72 |
st.title("Healthcare Knowledge Chatbot")
|