Token Classification
GLiNER
PyTorch
multilingual
bert
Rejebc commited on
Commit
7ccef2b
·
verified ·
1 Parent(s): db7185a

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -2
handler.py CHANGED
@@ -2,7 +2,7 @@ from typing import Dict, List, Any
2
  from gliner import GLiNER
3
 
4
  class EndpointHandler:
5
- def __init__(self, path=""):
6
  # Initialize the GLiNER model
7
  self.model = GLiNER.from_pretrained("urchade/gliner_multi-v2.1")
8
 
@@ -19,7 +19,8 @@ class EndpointHandler:
19
  # Get inputs and labels
20
  inputs = data.get("inputs", "")
21
  labels = ["party", "document title"]
22
-
 
23
  # Predict entities using GLiNER
24
  entities = self.model.predict_entities(inputs, labels)
25
 
@@ -29,6 +30,7 @@ class EndpointHandler:
29
  formatted_entity = {
30
  entity["label"]: entity["text"],
31
  }
 
32
  formatted_results.append(formatted_entity)
33
 
34
  return formatted_results
 
2
  from gliner import GLiNER
3
 
4
  class EndpointHandler:
5
+ def __init__(self, path="."):
6
  # Initialize the GLiNER model
7
  self.model = GLiNER.from_pretrained("urchade/gliner_multi-v2.1")
8
 
 
19
  # Get inputs and labels
20
  inputs = data.get("inputs", "")
21
  labels = ["party", "document title"]
22
+ print('path', path)
23
+ print('labels',labels)
24
  # Predict entities using GLiNER
25
  entities = self.model.predict_entities(inputs, labels)
26
 
 
30
  formatted_entity = {
31
  entity["label"]: entity["text"],
32
  }
33
+ print(formatted_entity)
34
  formatted_results.append(formatted_entity)
35
 
36
  return formatted_results