Update handler.py
Browse filesChange the attribute of the text when extracting the text from the inputs.
- handler.py +2 -2
handler.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoModelForSeq2SeqLM, NllbTokenizer
|
|
4 |
from transformers import pipeline
|
5 |
|
6 |
class EndpointHandler():
|
7 |
-
def __init__(self, path="
|
8 |
# Initialize the pre-trained translation pipeline
|
9 |
self.model = AutoModelForSeq2SeqLM.from_pretrained(path)
|
10 |
self.tokenizer = NllbTokenizer.from_pretrained(path)
|
@@ -20,7 +20,7 @@ class EndpointHandler():
|
|
20 |
Returns:
|
21 |
List[Dict[str, Any]]: A list of dictionaries containing translated sentences.
|
22 |
"""
|
23 |
-
text = data.get("
|
24 |
|
25 |
parameters = data.get("parameters", {})
|
26 |
src_lang = parameters.get("src_lang", "spa_Latn").strip()
|
|
|
4 |
from transformers import pipeline
|
5 |
|
6 |
class EndpointHandler():
|
7 |
+
def __init__(self, path="."):
|
8 |
# Initialize the pre-trained translation pipeline
|
9 |
self.model = AutoModelForSeq2SeqLM.from_pretrained(path)
|
10 |
self.tokenizer = NllbTokenizer.from_pretrained(path)
|
|
|
20 |
Returns:
|
21 |
List[Dict[str, Any]]: A list of dictionaries containing translated sentences.
|
22 |
"""
|
23 |
+
text = data.get("inputs", "")
|
24 |
|
25 |
parameters = data.get("parameters", {})
|
26 |
src_lang = parameters.get("src_lang", "spa_Latn").strip()
|