earlsab
commited on
Commit
路
2dc9fbe
1
Parent(s):
8c65642
point to local file
Browse files- __pycache__/handler.cpython-312.pyc +0 -0
- handler.py +4 -4
__pycache__/handler.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/handler.cpython-312.pyc and b/__pycache__/handler.cpython-312.pyc differ
|
|
|
handler.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from typing import Dict, List, Any
|
| 2 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 3 |
import torch
|
| 4 |
-
|
| 5 |
|
| 6 |
class EndpointHandler():
|
| 7 |
def __init__(self, path=""):
|
|
@@ -11,7 +11,7 @@ class EndpointHandler():
|
|
| 11 |
|
| 12 |
|
| 13 |
# Load the fine-tuned model
|
| 14 |
-
self.date_model_path = "deberta-qa-finetuned"
|
| 15 |
self.date_tokenizer = AutoTokenizer.from_pretrained(self.date_model_path)
|
| 16 |
self.date_model = AutoModelForQuestionAnswering.from_pretrained(self.date_model_path)
|
| 17 |
|
|
@@ -75,7 +75,7 @@ class EndpointHandler():
|
|
| 75 |
return answer
|
| 76 |
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
# init handler
|
| 81 |
my_handler = EndpointHandler(path=".")
|
|
@@ -89,5 +89,5 @@ non_holiday_pred=my_handler(non_holiday_payload)
|
|
| 89 |
# holiday_payload=my_handler(holiday_payload)
|
| 90 |
|
| 91 |
# show results
|
| 92 |
-
|
| 93 |
# print("holiday_payload", holiday_payload)
|
|
|
|
| 1 |
from typing import Dict, List, Any
|
| 2 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 3 |
import torch
|
| 4 |
+
|
| 5 |
|
| 6 |
class EndpointHandler():
|
| 7 |
def __init__(self, path=""):
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
# Load the fine-tuned model
|
| 14 |
+
self.date_model_path = "./deberta-qa-finetuned"
|
| 15 |
self.date_tokenizer = AutoTokenizer.from_pretrained(self.date_model_path)
|
| 16 |
self.date_model = AutoModelForQuestionAnswering.from_pretrained(self.date_model_path)
|
| 17 |
|
|
|
|
| 75 |
return answer
|
| 76 |
|
| 77 |
|
| 78 |
+
from handler import EndpointHandler
|
| 79 |
|
| 80 |
# init handler
|
| 81 |
my_handler = EndpointHandler(path=".")
|
|
|
|
| 89 |
# holiday_payload=my_handler(holiday_payload)
|
| 90 |
|
| 91 |
# show results
|
| 92 |
+
print(non_holiday_pred)
|
| 93 |
# print("holiday_payload", holiday_payload)
|