Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,8 +20,8 @@ from sklearn.metrics import accuracy_score
|
|
20 |
|
21 |
|
22 |
# Suppress TensorFlow warnings
|
23 |
-
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
24 |
-
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
|
25 |
|
26 |
# Download necessary NLTK resources
|
27 |
nltk.download("punkt")
|
@@ -59,7 +59,7 @@ def load_data():
|
|
59 |
tr = pd.read_csv("Testing.csv")
|
60 |
except FileNotFoundError:
|
61 |
raise RuntimeError("Data files not found. Please ensure `Training.csv` and `Testing.csv` are uploaded correctly.")
|
62 |
-
|
63 |
disease_dict = {
|
64 |
'Fungal infection': 0, 'Allergy': 1, 'GERD': 2, 'Chronic cholestasis': 3, 'Drug Reaction': 4,
|
65 |
'Peptic ulcer diseae': 5, 'AIDS': 6, 'Diabetes': 7, 'Gastroenteritis': 8, 'Bronchial Asthma': 9,
|
@@ -71,11 +71,12 @@ def load_data():
|
|
71 |
'Hypoglycemia': 32, 'Osteoarthritis': 33, 'Arthritis': 34
|
72 |
}
|
73 |
|
|
|
74 |
df.replace({'prognosis': disease_dict}, inplace=True)
|
75 |
-
df = df.infer_objects(copy=False
|
76 |
|
77 |
tr.replace({'prognosis': disease_dict}, inplace=True)
|
78 |
-
tr = tr.infer_objects(copy=False
|
79 |
|
80 |
return df, tr, disease_dict
|
81 |
|
|
|
20 |
|
21 |
|
22 |
# Suppress TensorFlow warnings
|
23 |
+
os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # No GPU available, use CPU only
|
24 |
+
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" # Suppress TensorFlow logging
|
25 |
|
26 |
# Download necessary NLTK resources
|
27 |
nltk.download("punkt")
|
|
|
59 |
tr = pd.read_csv("Testing.csv")
|
60 |
except FileNotFoundError:
|
61 |
raise RuntimeError("Data files not found. Please ensure `Training.csv` and `Testing.csv` are uploaded correctly.")
|
62 |
+
|
63 |
disease_dict = {
|
64 |
'Fungal infection': 0, 'Allergy': 1, 'GERD': 2, 'Chronic cholestasis': 3, 'Drug Reaction': 4,
|
65 |
'Peptic ulcer diseae': 5, 'AIDS': 6, 'Diabetes': 7, 'Gastroenteritis': 8, 'Bronchial Asthma': 9,
|
|
|
71 |
'Hypoglycemia': 32, 'Osteoarthritis': 33, 'Arthritis': 34
|
72 |
}
|
73 |
|
74 |
+
# Replace prognosis values with numerical categories
|
75 |
df.replace({'prognosis': disease_dict}, inplace=True)
|
76 |
+
df = df.infer_objects() # Removed 'copy=False' argument
|
77 |
|
78 |
tr.replace({'prognosis': disease_dict}, inplace=True)
|
79 |
+
tr = tr.infer_objects() # Removed 'copy=False' argument
|
80 |
|
81 |
return df, tr, disease_dict
|
82 |
|