Spaces:
Sleeping
Sleeping
fix: Correctly display precautions and occurrences as text
Browse files
frontend/Symptoms_Detection/app.py
CHANGED
@@ -189,21 +189,22 @@ if symptoms.lower() != "exit":
|
|
189 |
prediction = predict_symptoms(' '.join(symptoms_list))
|
190 |
|
191 |
|
192 |
-
st.write(prediction)
|
193 |
|
194 |
# Display precautions
|
195 |
st.write("Precautions:")
|
196 |
-
precautions = precaution(prediction)
|
197 |
if precautions:
|
198 |
for precaution_list in precautions:
|
199 |
for precaution_item in precaution_list:
|
200 |
-
|
|
|
201 |
else:
|
202 |
st.write("No precautions found for this disease.")
|
203 |
|
204 |
# Display occurrences
|
205 |
st.write("Occurrence:")
|
206 |
-
occurrences = occurance(prediction)
|
207 |
if occurrences:
|
208 |
for occurrence in occurrences:
|
209 |
st.write(f"- {occurrence}")
|
|
|
189 |
prediction = predict_symptoms(' '.join(symptoms_list))
|
190 |
|
191 |
|
192 |
+
st.write(prediction[0]) # Extract the string from the numpy array
|
193 |
|
194 |
# Display precautions
|
195 |
st.write("Precautions:")
|
196 |
+
precautions = precaution(prediction[0]) # Pass the string, not the array
|
197 |
if precautions:
|
198 |
for precaution_list in precautions:
|
199 |
for precaution_item in precaution_list:
|
200 |
+
if precaution_item: # Check if the item is not None or empty
|
201 |
+
st.write(f"- {precaution_item}")
|
202 |
else:
|
203 |
st.write("No precautions found for this disease.")
|
204 |
|
205 |
# Display occurrences
|
206 |
st.write("Occurrence:")
|
207 |
+
occurrences = occurance(prediction[0]) # Pass the string, not the array
|
208 |
if occurrences:
|
209 |
for occurrence in occurrences:
|
210 |
st.write(f"- {occurrence}")
|