Jenny Pereira
commited on
Commit
·
037aa2f
1
Parent(s):
e61f8a2
changes in testing 2
Browse files- __pycache__/handler.cpython-38.pyc +0 -0
- handler.py +3 -2
- pytorch_model.bin +3 -0
- test.py +0 -15
__pycache__/handler.cpython-38.pyc
CHANGED
Binary files a/__pycache__/handler.cpython-38.pyc and b/__pycache__/handler.cpython-38.pyc differ
|
|
handler.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
from typing import Dict, List, Any
|
|
|
2 |
from flair.data import Sentence
|
3 |
from flair.models import SequenceTagger
|
4 |
|
5 |
class EndpointHandler():
|
6 |
-
def __init__(self, path=
|
7 |
#code
|
8 |
-
self.tagger = SequenceTagger.load(path)
|
9 |
|
10 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
11 |
#code
|
|
|
1 |
from typing import Dict, List, Any
|
2 |
+
import os
|
3 |
from flair.data import Sentence
|
4 |
from flair.models import SequenceTagger
|
5 |
|
6 |
class EndpointHandler():
|
7 |
+
def __init__(self, path=str):
|
8 |
#code
|
9 |
+
self.tagger = SequenceTagger.load(os.path.join(path,"pytorch_model.bin"))
|
10 |
|
11 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
12 |
#code
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2b82e0b8446a75c00fd0668f8eb69c382c669014698b001370f689ede2189716
|
3 |
+
size 779686033
|
test.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
from handler import EndpointHandler
|
2 |
-
import pathlib
|
3 |
-
import os
|
4 |
-
|
5 |
-
if os.name == 'nt': # Minor patch needed if you are running from Windows
|
6 |
-
temp = pathlib.PosixPath
|
7 |
-
pathlib.PosixPath = pathlib.WindowsPath
|
8 |
-
|
9 |
-
my_handler = EndpointHandler()
|
10 |
-
|
11 |
-
test = {"inputs": "En la 'red carpet' lució un look muy urban con chunky shoes de inspiración anime."}
|
12 |
-
|
13 |
-
result = my_handler(test)
|
14 |
-
|
15 |
-
print(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|