Dorglorich commited on
Commit
0597856
Β·
verified Β·
1 Parent(s): 94b4ef6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -33
app.py CHANGED
@@ -1,37 +1,9 @@
1
-
2
  import streamlit as st
3
  import re
4
  import pandas as pd
5
  from sklearn.feature_extraction.text import TfidfVectorizer
6
  from sklearn.naive_bayes import MultinomialNB
7
- import numpy as np
8
  from sklearn.model_selection import train_test_split
9
- from sklearn.ensemble import RandomForestClassifier
10
- from sklearn.metrics import accuracy_score, classification_report
11
- import tensorflow as tf
12
- from sklearn.feature_extraction.text import TfidfVectorizer
13
- from sklearn.naive_bayes import MultinomialNB
14
- from sklearn.metrics import classification_report, confusion_matrix, accuracy_score
15
- import nltk
16
- from nltk.corpus import stopwords
17
- from nltk.stem import PorterStemmer
18
- from gensim.models import Word2Vec
19
- import matplotlib.pyplot as plt
20
- import seaborn as sns
21
-
22
-
23
-
24
- # for using TensorFlow for deep learning
25
- from tensorflow.keras.models import Sequential
26
- from tensorflow.keras.layers import Dense
27
- from tensorflow.keras.optimizers import Adam
28
- from tensorflow.keras.losses import categorical_crossentropy
29
-
30
- # for using PyTorch for deep learning
31
- import torch
32
- import torch.nn as nn
33
- import torch.optim as optim
34
- import torch.nn.functional as F
35
 
36
  # Load your symptom-disease data
37
  data = pd.read_csv("Symptom2Disease.csv")
@@ -52,11 +24,20 @@ model = MultinomialNB()
52
  model.fit(X_train, y_train)
53
 
54
  # Set Streamlit app title with emojis
55
- st.title("Healthcare Symptom-to-Disease Recommender πŸ₯πŸ‘¨β€βš•οΈ")
56
 
57
  # Define a sidebar
58
  st.sidebar.title("Tool Definition")
59
- st.sidebar.markdown("This tool helps you identify possible diseases based on the symptoms you provide. It is not a substitute for professional medical advice. Always consult a healthcare professional for accurate diagnosis and treatment.")
 
 
 
 
 
 
 
 
 
60
 
61
  # Initialize chat history
62
  if "messages" not in st.session_state:
@@ -97,8 +78,18 @@ if st.button("Predict Disease"):
97
  else:
98
  st.warning("Please enter your symptoms before predicting.")
99
 
100
- # Display a warning message
101
- st.warning("Please note that this tool is for informational purposes only. Always consult a healthcare professional for accurate medical advice.")
 
 
 
 
 
 
 
 
 
102
 
103
  # Add attribution
104
- st.markdown("Created ❀️ by Richard Dorglo")
 
 
 
1
  import streamlit as st
2
  import re
3
  import pandas as pd
4
  from sklearn.feature_extraction.text import TfidfVectorizer
5
  from sklearn.naive_bayes import MultinomialNB
 
6
  from sklearn.model_selection import train_test_split
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # Load your symptom-disease data
9
  data = pd.read_csv("Symptom2Disease.csv")
 
24
  model.fit(X_train, y_train)
25
 
26
  # Set Streamlit app title with emojis
27
+ st.title("Health Symptom-to-Disease Predictor πŸ₯πŸ‘¨β€βš•οΈ")
28
 
29
  # Define a sidebar
30
  st.sidebar.title("Tool Definition")
31
+ st.sidebar.markdown("This tool helps you identify possible diseases based on the symptoms you provide.")
32
+ st.sidebar.markdown("the tool may aid healthcare professionals in the initial assessment of potential conditions, facilitating quicker decision-making and improving patient care")
33
+
34
+ st.sidebar.title("⚠️ **Limitation**")
35
+ st.sidebar.markdown("This tool's predictions are based solely on symptom descriptions and may not account for other critical factors,")
36
+ st.sidebar.markdown("such as a patient's medical history or laboratory tests,")
37
+ st.sidebar.markdown("As such,it should be used as an initial reference and not as a sole diagnostic tool. πŸ‘©β€βš•οΈ")
38
+
39
+ st.warning("Please note that this tool is for informational purposes only. Always consult a healthcare professional for accurate medical advice.")
40
+ show_faqs = st.sidebar.checkbox("Show FAQs")
41
 
42
  # Initialize chat history
43
  if "messages" not in st.session_state:
 
78
  else:
79
  st.warning("Please enter your symptoms before predicting.")
80
 
81
+ # Create FAQs section
82
+ if show_faqs:
83
+ st.markdown("## Frequently Asked Questions")
84
+ st.markdown("**Q: How does this tool work?**")
85
+ st.markdown("A: The tool uses a machine learning model to analyze the symptoms you enter and predicts possible diseases based on a pre-trained dataset.")
86
+
87
+ st.markdown("**Q: Is this a substitute for a doctor's advice?**")
88
+ st.markdown("A: No, this tool is for informational purposes only. It's essential to consult a healthcare professional for accurate medical advice.")
89
+
90
+ st.markdown("**Q: Can I trust the predictions?**")
91
+ st.markdown("A: While the tool provides predictions, it's not a guarantee of accuracy. It's always best to consult a healthcare expert for a reliable diagnosis.")
92
 
93
  # Add attribution
94
+ st.markdown("Created ❀️ by Richard Dorglo")
95
+