Ntchinda-Giscard commited on
Commit
6990683
1 Parent(s): d811031

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +15 -15
utils.py CHANGED
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
28
  load_dotenv()
29
 
30
  ocr_model = PaddleOCR(lang='en')
31
- nlp_ner = spacy.load("en_pipeline")
32
  detector = YOLO('best.pt')
33
  vehicle = YOLO('yolov8x.pt')
34
 
@@ -140,24 +140,24 @@ def upload_to_s3(
140
  return None
141
 
142
 
143
- def ner_recog(text:str) -> dict:
144
- """
145
- Extract entities from text using SpaCy and return them as JSON.
146
 
147
- Args:
148
- - text: The input text.
149
 
150
- Returns:
151
- - dict: A dictionary containing the extracted entities in JSON format.
152
- """
153
- # Load SpaCy model
154
- # Process the text
155
- doc = nlp_ner(text)
156
 
157
- # Extract entities and format them as JSON
158
- entities = [{ent.label_ : ent.text} for ent in doc.ents]
159
 
160
- return {"entities": entities}
161
 
162
  def detect_licensePlate(img: str) -> dict:
163
  image = Image.open(img)
 
28
  load_dotenv()
29
 
30
  ocr_model = PaddleOCR(lang='en')
31
+ # nlp_ner = spacy.load("en_pipeline")
32
  detector = YOLO('best.pt')
33
  vehicle = YOLO('yolov8x.pt')
34
 
 
140
  return None
141
 
142
 
143
+ # def ner_recog(text:str) -> dict:
144
+ # """
145
+ # Extract entities from text using SpaCy and return them as JSON.
146
 
147
+ # Args:
148
+ # - text: The input text.
149
 
150
+ # Returns:
151
+ # - dict: A dictionary containing the extracted entities in JSON format.
152
+ # """
153
+ # # Load SpaCy model
154
+ # # Process the text
155
+ # doc = nlp_ner(text)
156
 
157
+ # # Extract entities and format them as JSON
158
+ # entities = [{ent.label_ : ent.text} for ent in doc.ents]
159
 
160
+ # return {"entities": entities}
161
 
162
  def detect_licensePlate(img: str) -> dict:
163
  image = Image.open(img)