Spaces:
Sleeping
Sleeping
Update app/utils.py
Browse files- app/utils.py +10 -1
app/utils.py
CHANGED
@@ -111,8 +111,17 @@ class OCRModel:
|
|
111 |
class AllergyAnalyzer:
|
112 |
def __init__(self, dataset_path):
|
113 |
self.dataset_path = dataset_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
self.allergy_dict = self.load_allergy_data()
|
115 |
-
nltk.download('punkt', quiet=True)
|
116 |
|
117 |
def load_allergy_data(self):
|
118 |
"""تحميل بيانات الحساسيات من ملف Excel"""
|
|
|
111 |
class AllergyAnalyzer:
|
112 |
def __init__(self, dataset_path):
|
113 |
self.dataset_path = dataset_path
|
114 |
+
# Ensure NLTK data is downloaded
|
115 |
+
try:
|
116 |
+
nltk.data.find('tokenizers/punkt')
|
117 |
+
except LookupError:
|
118 |
+
nltk.download('punkt')
|
119 |
+
try:
|
120 |
+
nltk.data.find('tokenizers/punkt_tab')
|
121 |
+
except LookupError:
|
122 |
+
nltk.download('punkt_tab')
|
123 |
+
|
124 |
self.allergy_dict = self.load_allergy_data()
|
|
|
125 |
|
126 |
def load_allergy_data(self):
|
127 |
"""تحميل بيانات الحساسيات من ملف Excel"""
|